mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Merge branch 'master' into plugins
This commit is contained in:
commit
7e6e5f520f
13
src/common.c
13
src/common.c
@ -167,19 +167,6 @@ str_contains(char str[], int size, char ch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
encode_xml(const char * const xml)
|
||||
{
|
||||
char *coded_msg = str_replace(xml, "&", "&");
|
||||
char *coded_msg2 = str_replace(coded_msg, "<", "<");
|
||||
char *coded_msg3 = str_replace(coded_msg2, ">", ">");
|
||||
|
||||
free(coded_msg);
|
||||
free(coded_msg2);
|
||||
|
||||
return coded_msg3;
|
||||
}
|
||||
|
||||
char *
|
||||
prof_getline(FILE *stream)
|
||||
{
|
||||
|
@ -77,7 +77,6 @@ gboolean mkdir_recursive(const char *dir);
|
||||
char * str_replace(const char *string, const char *substr,
|
||||
const char *replacement);
|
||||
int str_contains(char str[], int size, char ch);
|
||||
char* encode_xml(const char * const xml);
|
||||
char * prof_getline(FILE *stream);
|
||||
char* release_get_latest(void);
|
||||
gboolean release_is_new(char *found_version);
|
||||
|
@ -81,6 +81,7 @@ cb_write_fingerprints(void *opdata)
|
||||
g_string_append(basedir, "/profanity/otr/");
|
||||
g_string_append(basedir, account_dir);
|
||||
g_string_append(basedir, "/");
|
||||
free(account_dir);
|
||||
|
||||
GString *fpsfilename = g_string_new(basedir->str);
|
||||
g_string_append(fpsfilename, "fingerprints.txt");
|
||||
@ -128,6 +129,7 @@ otr_on_connect(ProfAccount *account)
|
||||
g_string_append(basedir, "/profanity/otr/");
|
||||
g_string_append(basedir, account_dir);
|
||||
g_string_append(basedir, "/");
|
||||
free(account_dir);
|
||||
|
||||
if (!mkdir_recursive(basedir->str)) {
|
||||
log_error("Could not create %s for account %s.", basedir->str, jid);
|
||||
@ -209,6 +211,7 @@ otr_keygen(ProfAccount *account)
|
||||
g_string_append(basedir, "/profanity/otr/");
|
||||
g_string_append(basedir, account_dir);
|
||||
g_string_append(basedir, "/");
|
||||
free(account_dir);
|
||||
|
||||
if (!mkdir_recursive(basedir->str)) {
|
||||
log_error("Could not create %s for account %s.", basedir->str, jid);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "ui/ui.h"
|
||||
#include "ui/windows.h"
|
||||
#include "ui/window.h"
|
||||
#include "roster_list.h"
|
||||
|
||||
#define CONSOLE_TITLE "Profanity. Type /help for help information."
|
||||
|
||||
@ -158,7 +159,8 @@ _title_bar_draw(void)
|
||||
#ifdef PROF_HAVE_LIBOTR
|
||||
// show privacy
|
||||
if (current_recipient != NULL) {
|
||||
ProfWin *current = wins_get_by_recipient(current_recipient);
|
||||
char *recipient_jid = roster_barejid_from_name(current_recipient);
|
||||
ProfWin *current = wins_get_by_recipient(recipient_jid);
|
||||
if (current != NULL) {
|
||||
if (current->type == WIN_CHAT) {
|
||||
if (!current->is_otr) {
|
||||
|
@ -14,6 +14,8 @@ void replace_one_substr(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("it was a string", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_one_substr_beginning(void **state)
|
||||
@ -25,6 +27,8 @@ void replace_one_substr_beginning(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("that is a string", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_one_substr_end(void **state)
|
||||
@ -36,6 +40,8 @@ void replace_one_substr_end(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("it is a thing", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_two_substr(void **state)
|
||||
@ -47,6 +53,8 @@ void replace_two_substr(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("it was a was string", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_char(void **state)
|
||||
@ -58,6 +66,8 @@ void replace_char(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("some & a thing & something else", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_when_none(void **state)
|
||||
@ -69,6 +79,8 @@ void replace_when_none(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("its another string", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_when_match(void **state)
|
||||
@ -80,6 +92,8 @@ void replace_when_match(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("goodbye", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_when_string_empty(void **state)
|
||||
@ -91,6 +105,8 @@ void replace_when_string_empty(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_when_string_null(void **state)
|
||||
@ -113,6 +129,8 @@ void replace_when_sub_empty(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("hello", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_when_sub_null(void **state)
|
||||
@ -124,6 +142,8 @@ void replace_when_sub_null(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("hello", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_when_new_empty(void **state)
|
||||
@ -135,6 +155,8 @@ void replace_when_new_empty(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void replace_when_new_null(void **state)
|
||||
@ -146,6 +168,8 @@ void replace_when_new_null(void **state)
|
||||
char *result = str_replace(string, sub, new);
|
||||
|
||||
assert_string_equal("hello", result);
|
||||
|
||||
free(result);
|
||||
}
|
||||
|
||||
void compare_win_nums_less(void **state)
|
||||
|
Loading…
Reference in New Issue
Block a user