mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-22 17:56:21 +00:00
Merge branch 'master' into pgp
This commit is contained in:
@@ -57,19 +57,19 @@ account_new(const gchar * const name, const gchar * const jid,
|
||||
|
||||
new_account->name = strdup(name);
|
||||
|
||||
if (jid != NULL) {
|
||||
if (jid) {
|
||||
new_account->jid = strdup(jid);
|
||||
} else {
|
||||
new_account->jid = strdup(name);
|
||||
}
|
||||
|
||||
if (password != NULL) {
|
||||
if (password) {
|
||||
new_account->password = strdup(password);
|
||||
} else {
|
||||
new_account->password = NULL;
|
||||
}
|
||||
|
||||
if (eval_password != NULL) {
|
||||
if (eval_password) {
|
||||
new_account->eval_password = strdup(eval_password);
|
||||
} else {
|
||||
new_account->eval_password = NULL;
|
||||
@@ -77,13 +77,13 @@ account_new(const gchar * const name, const gchar * const jid,
|
||||
|
||||
new_account->enabled = enabled;
|
||||
|
||||
if (server != NULL) {
|
||||
if (server) {
|
||||
new_account->server = strdup(server);
|
||||
} else {
|
||||
new_account->server = NULL;
|
||||
}
|
||||
|
||||
if (resource != NULL) {
|
||||
if (resource) {
|
||||
new_account->resource = strdup(resource);
|
||||
} else {
|
||||
new_account->resource = NULL;
|
||||
@@ -134,7 +134,7 @@ account_new(const gchar * const name, const gchar * const jid,
|
||||
new_account->muc_nick = strdup(muc_nick);
|
||||
}
|
||||
|
||||
if (otr_policy != NULL) {
|
||||
if (otr_policy) {
|
||||
new_account->otr_policy = strdup(otr_policy);
|
||||
} else {
|
||||
new_account->otr_policy = NULL;
|
||||
@@ -156,7 +156,7 @@ account_new(const gchar * const name, const gchar * const jid,
|
||||
char *
|
||||
account_create_full_jid(ProfAccount *account)
|
||||
{
|
||||
if (account->resource != NULL) {
|
||||
if (account->resource) {
|
||||
return create_fulljid(account->jid, account->resource);
|
||||
} else {
|
||||
return strdup(account->jid);
|
||||
@@ -204,7 +204,7 @@ account_eval_password(ProfAccount *account)
|
||||
void
|
||||
account_free(ProfAccount *account)
|
||||
{
|
||||
if (account != NULL) {
|
||||
if (account) {
|
||||
free(account->name);
|
||||
free(account->jid);
|
||||
free(account->password);
|
||||
|
||||
@@ -147,9 +147,9 @@ accounts_add(const char *account_name, const char *altdomain, const int port)
|
||||
const char *barejid = account_name;
|
||||
const char *resource = "profanity";
|
||||
Jid *jid = jid_create(account_name);
|
||||
if (jid != NULL) {
|
||||
if (jid) {
|
||||
barejid = jid->barejid;
|
||||
if (jid->resourcepart != NULL) {
|
||||
if (jid->resourcepart) {
|
||||
resource = jid->resourcepart;
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ accounts_add(const char *account_name, const char *altdomain, const int port)
|
||||
g_key_file_set_boolean(accounts, account_name, "enabled", TRUE);
|
||||
g_key_file_set_string(accounts, account_name, "jid", barejid);
|
||||
g_key_file_set_string(accounts, account_name, "resource", resource);
|
||||
if (altdomain != NULL) {
|
||||
if (altdomain) {
|
||||
g_key_file_set_string(accounts, account_name, "server", altdomain);
|
||||
}
|
||||
if (port != 0) {
|
||||
@@ -252,7 +252,7 @@ accounts_get_account(const char * const name)
|
||||
gsize length;
|
||||
GList *otr_manual = NULL;
|
||||
gchar **manual = g_key_file_get_string_list(accounts, name, "otr.manual", &length, NULL);
|
||||
if (manual != NULL) {
|
||||
if (manual) {
|
||||
int i = 0;
|
||||
for (i = 0; i < length; i++) {
|
||||
otr_manual = g_list_append(otr_manual, strdup(manual[i]));
|
||||
@@ -262,7 +262,7 @@ accounts_get_account(const char * const name)
|
||||
|
||||
GList *otr_opportunistic = NULL;
|
||||
gchar **opportunistic = g_key_file_get_string_list(accounts, name, "otr.opportunistic", &length, NULL);
|
||||
if (opportunistic != NULL) {
|
||||
if (opportunistic) {
|
||||
int i = 0;
|
||||
for (i = 0; i < length; i++) {
|
||||
otr_opportunistic = g_list_append(otr_opportunistic, strdup(opportunistic[i]));
|
||||
@@ -272,7 +272,7 @@ accounts_get_account(const char * const name)
|
||||
|
||||
GList *otr_always = NULL;
|
||||
gchar **always = g_key_file_get_string_list(accounts, name, "otr.always", &length, NULL);
|
||||
if (always != NULL) {
|
||||
if (always) {
|
||||
int i = 0;
|
||||
for (i = 0; i < length; i++) {
|
||||
otr_always = g_list_append(otr_always, strdup(always[i]));
|
||||
@@ -362,7 +362,7 @@ accounts_rename(const char * const account_name, const char * const new_name)
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(string_keys); i++) {
|
||||
char *value = g_key_file_get_string(accounts, account_name, string_keys[i], NULL);
|
||||
if (value != NULL) {
|
||||
if (value) {
|
||||
g_key_file_set_string(accounts, new_name, string_keys[i], value);
|
||||
g_free(value);
|
||||
}
|
||||
@@ -392,10 +392,10 @@ void
|
||||
accounts_set_jid(const char * const account_name, const char * const value)
|
||||
{
|
||||
Jid *jid = jid_create(value);
|
||||
if (jid != NULL) {
|
||||
if (jid) {
|
||||
if (accounts_account_exists(account_name)) {
|
||||
g_key_file_set_string(accounts, account_name, "jid", jid->barejid);
|
||||
if (jid->resourcepart != NULL) {
|
||||
if (jid->resourcepart) {
|
||||
g_key_file_set_string(accounts, account_name, "resource", jid->resourcepart);
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ accounts_add_otr_policy(const char * const account_name, const char * const cont
|
||||
GList *glist = NULL;
|
||||
|
||||
// list found
|
||||
if (list != NULL) {
|
||||
if (list) {
|
||||
int i = 0;
|
||||
for (i = 0; i < length; i++) {
|
||||
// item already in list, exit function
|
||||
@@ -553,7 +553,7 @@ accounts_add_otr_policy(const char * const account_name, const char * const cont
|
||||
const gchar* new_list[g_list_length(glist)+1];
|
||||
GList *curr = glist;
|
||||
i = 0;
|
||||
while (curr != NULL) {
|
||||
while (curr) {
|
||||
new_list[i++] = strdup(curr->data);
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
@@ -596,7 +596,7 @@ _remove_from_list(GKeyFile *accounts, const char * const account_name, const cha
|
||||
gsize length;
|
||||
gchar **list = g_key_file_get_string_list(accounts, account_name, key, &length, NULL);
|
||||
|
||||
if (list != NULL) {
|
||||
if (list) {
|
||||
int i = 0;
|
||||
GList *glist = NULL;
|
||||
gboolean deleted = FALSE;
|
||||
@@ -619,7 +619,7 @@ _remove_from_list(GKeyFile *accounts, const char * const account_name, const cha
|
||||
const gchar* new_list[g_list_length(glist)+1];
|
||||
GList *curr = glist;
|
||||
i = 0;
|
||||
while (curr != NULL) {
|
||||
while (curr) {
|
||||
new_list[i++] = strdup(curr->data);
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
@@ -790,7 +790,7 @@ accounts_get_last_presence(const char * const account_name)
|
||||
result = RESOURCE_ONLINE;
|
||||
}
|
||||
|
||||
if (setting != NULL) {
|
||||
if (setting) {
|
||||
g_free(setting);
|
||||
}
|
||||
return result;
|
||||
@@ -820,7 +820,7 @@ accounts_get_login_presence(const char * const account_name)
|
||||
result = RESOURCE_ONLINE;
|
||||
}
|
||||
|
||||
if (setting != NULL) {
|
||||
if (setting) {
|
||||
g_free(setting);
|
||||
}
|
||||
return result;
|
||||
@@ -833,9 +833,9 @@ _fix_legacy_accounts(const char * const account_name)
|
||||
const char *barejid = account_name;
|
||||
const char *resource = "profanity";
|
||||
Jid *jid = jid_create(account_name);
|
||||
if (jid != NULL) {
|
||||
if (jid) {
|
||||
barejid = jid->barejid;
|
||||
if (jid->resourcepart != NULL) {
|
||||
if (jid->resourcepart) {
|
||||
resource = jid->resourcepart;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ prefs_load(void)
|
||||
|
||||
err = NULL;
|
||||
log_maxsize = g_key_file_get_integer(prefs, PREF_GROUP_LOGGING, "maxsize", &err);
|
||||
if (err != NULL) {
|
||||
if (err) {
|
||||
log_maxsize = 0;
|
||||
g_error_free(err);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ prefs_get_string(preference_t pref)
|
||||
char *result = g_key_file_get_string(prefs, group, key, NULL);
|
||||
|
||||
if (result == NULL) {
|
||||
if (def != NULL) {
|
||||
if (def) {
|
||||
return strdup(def);
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -193,7 +193,7 @@ prefs_get_string(preference_t pref)
|
||||
void
|
||||
prefs_free_string(char *pref)
|
||||
{
|
||||
if (pref != NULL) {
|
||||
if (pref) {
|
||||
free(pref);
|
||||
}
|
||||
pref = NULL;
|
||||
@@ -419,7 +419,7 @@ prefs_get_aliases(void)
|
||||
char *name = keys[i];
|
||||
char *value = g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL);
|
||||
|
||||
if (value != NULL) {
|
||||
if (value) {
|
||||
ProfAlias *alias = malloc(sizeof(struct prof_alias_t));
|
||||
alias->name = strdup(name);
|
||||
alias->value = strdup(value);
|
||||
|
||||
@@ -160,7 +160,7 @@ _theme_load_file(const char * const theme_name)
|
||||
{
|
||||
// use default theme
|
||||
if (theme_name == NULL || strcmp(theme_name, "default") == 0) {
|
||||
if (theme != NULL) {
|
||||
if (theme) {
|
||||
g_key_file_free(theme);
|
||||
}
|
||||
theme = g_key_file_new();
|
||||
@@ -173,12 +173,12 @@ _theme_load_file(const char * const theme_name)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (theme_loc != NULL) {
|
||||
if (theme_loc) {
|
||||
g_string_free(theme_loc, TRUE);
|
||||
}
|
||||
theme_loc = new_theme_file;
|
||||
log_info("Loading theme \"%s\"", theme_name);
|
||||
if (theme != NULL) {
|
||||
if (theme) {
|
||||
g_key_file_free(theme);
|
||||
}
|
||||
theme = g_key_file_new();
|
||||
@@ -205,10 +205,10 @@ theme_list(void)
|
||||
void
|
||||
theme_close(void)
|
||||
{
|
||||
if (theme != NULL) {
|
||||
if (theme) {
|
||||
g_key_file_free(theme);
|
||||
}
|
||||
if (theme_loc != NULL) {
|
||||
if (theme_loc) {
|
||||
g_string_free(theme_loc, TRUE);
|
||||
}
|
||||
if (bold_items) {
|
||||
@@ -476,9 +476,9 @@ void
|
||||
_theme_list_dir(const gchar * const dir, GSList **result)
|
||||
{
|
||||
GDir *themes = g_dir_open(dir, 0, NULL);
|
||||
if (themes != NULL) {
|
||||
if (themes) {
|
||||
const gchar *theme = g_dir_read_name(themes);
|
||||
while (theme != NULL) {
|
||||
while (theme) {
|
||||
*result = g_slist_append(*result, strdup(theme));
|
||||
theme = g_dir_read_name(themes);
|
||||
}
|
||||
@@ -492,7 +492,7 @@ _theme_find(const char * const theme_name)
|
||||
GString *path = NULL;
|
||||
gchar *themes_dir = _get_themes_dir();
|
||||
|
||||
if (themes_dir != NULL) {
|
||||
if (themes_dir) {
|
||||
path = g_string_new(themes_dir);
|
||||
g_free(themes_dir);
|
||||
g_string_append(path, "/");
|
||||
|
||||
Reference in New Issue
Block a user