diff options
author | James Booth <boothj5@gmail.com> | 2015-05-04 23:40:58 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-05-04 23:40:58 +0100 |
commit | 3fd9692aecf190d079b119f66e046c8ed9013031 (patch) | |
tree | f2688404a0b898365d1e9e26f4c8f1335ca134b8 /src/ui | |
parent | 176fba84a04d8c0864b57feb848cccfe5c4814e3 (diff) | |
parent | 6f3750c6aa1ba72378ac004e6abceb19ed1ddecb (diff) | |
download | profani-tty-3fd9692aecf190d079b119f66e046c8ed9013031.tar.gz |
Merge branch 'master' into pgp
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/console.c | 160 | ||||
-rw-r--r-- | src/ui/core.c | 124 | ||||
-rw-r--r-- | src/ui/notifier.c | 8 | ||||
-rw-r--r-- | src/ui/statusbar.c | 14 | ||||
-rw-r--r-- | src/ui/titlebar.c | 6 | ||||
-rw-r--r-- | src/ui/window.c | 76 | ||||
-rw-r--r-- | src/ui/windows.c | 36 |
7 files changed, 212 insertions, 212 deletions
diff --git a/src/ui/console.c b/src/ui/console.c index 246dc336..c8d19825 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -126,8 +126,8 @@ cons_show_typing(const char * const barejid) ProfWin *console = wins_get_console(); const char * display_usr = NULL; PContact contact = roster_get_contact(barejid); - if (contact != NULL) { - if (p_contact_name(contact) != NULL) { + if (contact) { + if (p_contact_name(contact)) { display_usr = p_contact_name(contact); } else { display_usr = barejid; @@ -200,7 +200,7 @@ cons_check_version(gboolean not_available_msg) ProfWin *console = wins_get_console(); char *latest_release = release_get_latest(); - if (latest_release != NULL) { + if (latest_release) { gboolean relase_valid = g_regex_match_simple("^\\d+\\.\\d+\\.\\d+$", latest_release, 0, 0); if (relase_valid) { @@ -247,7 +247,7 @@ cons_show_wins(void) GSList *window_strings = wins_create_summary(); GSList *curr = window_strings; - while (curr != NULL) { + while (curr) { win_println(console, curr->data); curr = g_slist_next(curr); } @@ -265,7 +265,7 @@ cons_show_room_invites(GSList *invites) cons_show("No outstanding chat room invites."); } else { cons_show("Chat room invites, use /join or /decline commands:"); - while (invites != NULL) { + while (invites) { cons_show(" %s", invites->data); invites = g_slist_next(invites); } @@ -298,48 +298,48 @@ cons_show_caps(const char * const fulljid, resource_presence_t presence) win_print(console, '-', NULL, NO_DATE, 0, "", ":"); // show identity - if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) { + if (caps->category || caps->type || caps->name) { win_print(console, '-', NULL, NO_EOL, 0, "", "Identity: "); - if (caps->name != NULL) { + if (caps->name) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name); - if ((caps->category != NULL) || (caps->type != NULL)) { + if (caps->category || caps->type) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); } } - if (caps->type != NULL) { + if (caps->type) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type); - if (caps->category != NULL) { + if (caps->category) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); } } - if (caps->category != NULL) { + if (caps->category) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category); } win_newline(console); } - if (caps->software != NULL) { + if (caps->software) { win_vprint(console, '-', NULL, NO_EOL, 0, "", "Software: %s", caps->software); } - if (caps->software_version != NULL) { + if (caps->software_version) { win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); } - if ((caps->software != NULL) || (caps->software_version != NULL)) { + if (caps->software || caps->software_version) { win_newline(console); } - if (caps->os != NULL) { + if (caps->os) { win_vprint(console, '-', NULL, NO_EOL, 0, "", "OS: %s", caps->os); } - if (caps->os_version != NULL) { + if (caps->os_version) { win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); } - if ((caps->os != NULL) || (caps->os_version != NULL)) { + if (caps->os || caps->os_version) { win_newline(console); } - if (caps->features != NULL) { + if (caps->features) { win_println(console, "Features:"); GSList *feature = caps->features; - while (feature != NULL) { + while (feature) { win_vprint(console, '-', NULL, 0, 0, "", " %s", feature->data); feature = g_slist_next(feature); } @@ -358,19 +358,19 @@ cons_show_software_version(const char * const jid, const char * const presence, const char * const name, const char * const version, const char * const os) { ProfWin *console = wins_get_console(); - if ((name != NULL) || (version != NULL) || (os != NULL)) { + if (name || version || os) { cons_show(""); theme_item_t presence_colour = theme_main_presence_attrs(presence); win_vprint(console, '-', NULL, NO_EOL, presence_colour, "", "%s", jid); win_print(console, '-', NULL, NO_DATE, 0, "", ":"); } - if (name != NULL) { + if (name) { cons_show("Name : %s", name); } - if (version != NULL) { + if (version) { cons_show("Version : %s", version); } - if (os != NULL) { + if (os) { cons_show("OS : %s", os); } @@ -386,7 +386,7 @@ cons_show_received_subs(void) } else { cons_show("Outstanding subscription requests from:", g_slist_length(received)); - while (received != NULL) { + while (received) { cons_show(" %s", received->data); received = g_slist_next(received); } @@ -404,7 +404,7 @@ cons_show_sent_subs(void) PContact contact = NULL; cons_show("Awaiting subscription responses from:"); GSList *curr = contacts; - while (curr != NULL) { + while (curr) { contact = (PContact) curr->data; if (p_contact_pending_out(contact)) { cons_show(" %s", p_contact_barejid(contact)); @@ -422,12 +422,12 @@ void cons_show_room_list(GSList *rooms, const char * const conference_node) { ProfWin *console = wins_get_console(); - if ((rooms != NULL) && (g_slist_length(rooms) > 0)) { + if (rooms && (g_slist_length(rooms) > 0)) { cons_show("Chat rooms at %s:", conference_node); - while (rooms != NULL) { + while (rooms) { DiscoItem *room = rooms->data; win_vprint(console, '-', NULL, NO_EOL, 0, "", " %s", room->jid); - if (room->name != NULL) { + if (room->name) { win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", (%s)", room->name); } win_newline(console); @@ -452,7 +452,7 @@ cons_show_bookmarks(const GList *list) cons_show(""); cons_show("Bookmarks:"); - while (list != NULL) { + while (list) { Bookmark *item = list->data; theme_item_t presence_colour = THEME_TEXT; @@ -461,18 +461,18 @@ cons_show_bookmarks(const GList *list) presence_colour = THEME_ONLINE; } win_vprint(console, '-', NULL, NO_EOL, presence_colour, "", " %s", item->jid); - if (item->nick != NULL) { + if (item->nick) { win_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", "/%s", item->nick); } if (item->autojoin) { win_print(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (autojoin)"); } - if (item->password != NULL) { + if (item->password) { win_print(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (private)"); } if (muc_active(item->jid)) { ProfWin *roomwin = (ProfWin*)wins_get_muc(item->jid); - if (roomwin != NULL) { + if (roomwin) { int num = wins_get_num(roomwin); win_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (%d)", num); } @@ -487,26 +487,26 @@ cons_show_bookmarks(const GList *list) void cons_show_disco_info(const char *jid, GSList *identities, GSList *features) { - if (((identities != NULL) && (g_slist_length(identities) > 0)) || - ((features != NULL) && (g_slist_length(features) > 0))) { + if ((identities && (g_slist_length(identities) > 0)) || + (features && (g_slist_length(features) > 0))) { cons_show(""); cons_show("Service disovery info for %s", jid); - if (identities != NULL) { + if (identities) { cons_show(" Identities"); } - while (identities != NULL) { + while (identities) { DiscoIdentity *identity = identities->data; // anme trpe, cat GString *identity_str = g_string_new(" "); - if (identity->name != NULL) { + if (identity->name) { identity_str = g_string_append(identity_str, identity->name); identity_str = g_string_append(identity_str, " "); } - if (identity->type != NULL) { + if (identity->type) { identity_str = g_string_append(identity_str, identity->type); identity_str = g_string_append(identity_str, " "); } - if (identity->category != NULL) { + if (identity->category) { identity_str = g_string_append(identity_str, identity->category); } cons_show(identity_str->str); @@ -514,10 +514,10 @@ cons_show_disco_info(const char *jid, GSList *identities, GSList *features) identities = g_slist_next(identities); } - if (features != NULL) { + if (features) { cons_show(" Features:"); } - while (features != NULL) { + while (features) { cons_show(" %s", features->data); features = g_slist_next(features); } @@ -530,13 +530,13 @@ void cons_show_disco_items(GSList *items, const char * const jid) { ProfWin *console = wins_get_console(); - if ((items != NULL) && (g_slist_length(items) > 0)) { + if (items && (g_slist_length(items) > 0)) { cons_show(""); cons_show("Service discovery items for %s:", jid); - while (items != NULL) { + while (items) { DiscoItem *item = items->data; win_vprint(console, '-', NULL, NO_EOL, 0, "", " %s", item->jid); - if (item->name != NULL) { + if (item->name) { win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", (%s)", item->name); } win_vprint(console, '-', NULL, NO_DATE, 0, "", ""); @@ -556,7 +556,7 @@ cons_show_status(const char * const barejid) ProfWin *console = wins_get_console(); PContact pcontact = roster_get_contact(barejid); - if (pcontact != NULL) { + if (pcontact) { win_show_contact(console, pcontact); } else { cons_show("No such contact \"%s\" in roster.", barejid); @@ -571,8 +571,8 @@ cons_show_room_invite(const char * const invitor, const char * const room, { char *display_from = NULL; PContact contact = roster_get_contact(invitor); - if (contact != NULL) { - if (p_contact_name(contact) != NULL) { + if (contact) { + if (p_contact_name(contact)) { display_from = strdup(p_contact_name(contact)); } else { display_from = strdup(invitor); @@ -586,7 +586,7 @@ cons_show_room_invite(const char * const invitor, const char * const room, cons_show(" From : %s", display_from); cons_show(" Room : %s", room); - if (reason != NULL) { + if (reason) { cons_show(" Message: %s", reason); } @@ -673,9 +673,9 @@ cons_show_account(ProfAccount *account) if (g_list_length(account->otr_manual) > 0) { GString *manual = g_string_new("OTR manual : "); GList *curr = account->otr_manual; - while (curr != NULL) { + while (curr) { g_string_append(manual, curr->data); - if (curr->next != NULL) { + if (curr->next) { g_string_append(manual, ", "); } curr = curr->next; @@ -686,9 +686,9 @@ cons_show_account(ProfAccount *account) if (g_list_length(account->otr_opportunistic) > 0) { GString *opportunistic = g_string_new("OTR opportunistic : "); GList *curr = account->otr_opportunistic; - while (curr != NULL) { + while (curr) { g_string_append(opportunistic, curr->data); - if (curr->next != NULL) { + if (curr->next) { g_string_append(opportunistic, ", "); } curr = curr->next; @@ -699,9 +699,9 @@ cons_show_account(ProfAccount *account) if (g_list_length(account->otr_always) > 0) { GString *always = g_string_new("OTR always : "); GList *curr = account->otr_always; - while (curr != NULL) { + while (curr) { g_string_append(always, curr->data); - if (curr->next != NULL) { + if (curr->next) { g_string_append(always, ", "); } curr = curr->next; @@ -724,11 +724,11 @@ cons_show_account(ProfAccount *account) GList *ordered_resources = NULL; GList *curr = resources; - if (curr != NULL) { + if (curr) { win_println(console, "Resources:"); // sort in order of availability - while (curr != NULL) { + while (curr) { Resource *resource = curr->data; ordered_resources = g_list_insert_sorted(ordered_resources, resource, (GCompareFunc)resource_compare_availability); @@ -739,13 +739,13 @@ cons_show_account(ProfAccount *account) g_list_free(resources); curr = ordered_resources; - while (curr != NULL) { + while (curr) { Resource *resource = curr->data; const char *resource_presence = string_from_resource_presence(resource->presence); theme_item_t presence_colour = theme_main_presence_attrs(resource_presence); win_vprint(console, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence); - if (resource->status != NULL) { + if (resource->status) { win_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", resource->status); } win_vprint(console, '-', NULL, NO_DATE, 0, "", ""); @@ -753,43 +753,43 @@ cons_show_account(ProfAccount *account) Capabilities *caps = caps_lookup(jidp->fulljid); jid_destroy(jidp); - if (caps != NULL) { + if (caps) { // show identity - if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) { + if (caps->category || caps->type || caps->name) { win_print(console, '-', NULL, NO_EOL, 0, "", " Identity: "); - if (caps->name != NULL) { + if (caps->name) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name); - if ((caps->category != NULL) || (caps->type != NULL)) { + if (caps->category || caps->type) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); } } - if (caps->type != NULL) { + if (caps->type) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type); - if (caps->category != NULL) { + if (caps->category) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); } } - if (caps->category != NULL) { + if (caps->category) { win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category); } win_newline(console); } - if (caps->software != NULL) { + if (caps->software) { win_vprint(console, '-', NULL, NO_EOL, 0, "", " Software: %s", caps->software); } - if (caps->software_version != NULL) { + if (caps->software_version) { win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); } - if ((caps->software != NULL) || (caps->software_version != NULL)) { + if (caps->software || caps->software_version) { win_newline(console); } - if (caps->os != NULL) { + if (caps->os) { win_vprint(console, '-', NULL, NO_EOL, 0, "", " OS: %s", caps->os); } - if (caps->os_version != NULL) { + if (caps->os_version) { win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); } - if ((caps->os != NULL) || (caps->os_version != NULL)) { + if (caps->os || caps->os_version) { win_newline(console); } caps_destroy(caps); @@ -812,10 +812,10 @@ cons_show_aliases(GList *aliases) } GList *curr = aliases; - if (curr != NULL) { + if (curr) { cons_show("Command aliases:"); } - while (curr != NULL) { + while (curr) { ProfAlias *alias = curr->data; cons_show(" /%s -> %s", alias->name, alias->value); curr = g_list_next(curr); @@ -923,7 +923,7 @@ void cons_autoconnect_setting(void) { char *pref_connect_account = prefs_get_string(PREF_CONNECT_ACCOUNT); - if (pref_connect_account != NULL) + if (pref_connect_account) cons_show("Autoconnect (/autoconnect) : %s", pref_connect_account); else cons_show("Autoconnect (/autoconnect) : OFF"); @@ -1416,7 +1416,7 @@ cons_show_themes(GSList *themes) cons_show("No available themes."); } else { cons_show("Available themes:"); - while (themes != NULL) { + while (themes) { cons_show(themes->data); themes = g_slist_next(themes); } @@ -1488,7 +1488,7 @@ cons_show_roster_group(const char * const group, GSList *list) { cons_show(""); - if (list != NULL) { + if (list) { cons_show("%s:", group); } else { cons_show("No group named %s exists.", group); @@ -1632,7 +1632,7 @@ _show_roster_contacts(GSList *list, gboolean show_groups) PContact contact = curr->data; GString *title = g_string_new(" "); title = g_string_append(title, p_contact_barejid(contact)); - if (p_contact_name(contact) != NULL) { + if (p_contact_name(contact)) { title = g_string_append(title, " ("); title = g_string_append(title, p_contact_name(contact)); title = g_string_append(title, ")"); @@ -1674,11 +1674,11 @@ _show_roster_contacts(GSList *list, gboolean show_groups) if (show_groups) { GSList *groups = p_contact_groups(contact); - if (groups != NULL) { + if (groups) { GString *groups_str = g_string_new(" - "); - while (groups != NULL) { + while (groups) { g_string_append(groups_str, groups->data); - if (g_slist_next(groups) != NULL) { + if (g_slist_next(groups)) { g_string_append(groups_str, ", "); } groups = g_slist_next(groups); diff --git a/src/ui/core.c b/src/ui/core.c index e75d5432..06dd84e3 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -168,13 +168,13 @@ ui_get_idle_time(void) // if compiled with libxss, get the x sessions idle time #ifdef HAVE_LIBXSS XScreenSaverInfo *info = XScreenSaverAllocInfo(); - if (info != NULL && display != NULL) { + if (info && display) { XScreenSaverQueryInfo(display, DefaultRootWindow(display), info); unsigned long result = info->idle; XFree(info); return result; } - if (info != NULL) { + if (info) { XFree(info); } // if no libxss or xss idle time failed, use profanity idle time @@ -352,7 +352,7 @@ ui_contact_typing(const char * const barejid, const char * const resource) if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_TYPING_CURRENT)) ) { PContact contact = roster_get_contact(barejid); char const *display_usr = NULL; - if (p_contact_name(contact) != NULL) { + if (p_contact_name(contact)) { display_usr = p_contact_name(contact); } else { display_usr = barejid; @@ -423,9 +423,9 @@ ui_incoming_msg(const char * const barejid, const char * const resource, const c } // show users status first, when receiving message via delayed delivery - if ((tv_stamp != NULL) && (win_created)) { + if (tv_stamp && (win_created)) { PContact pcontact = roster_get_contact(barejid); - if (pcontact != NULL) { + if (pcontact) { win_show_contact(window, pcontact); } } @@ -515,7 +515,7 @@ ui_incoming_private_msg(const char * const fulljid, const char * const message, void ui_roster_add(const char * const barejid, const char * const name) { - if (name != NULL) { + if (name) { cons_show("Roster item added: %s (%s)", barejid, name); } else { cons_show("Roster item added: %s", barejid); @@ -562,7 +562,7 @@ void ui_auto_away(void) { char *pref_autoaway_message = prefs_get_string(PREF_AUTOAWAY_MESSAGE); - if (pref_autoaway_message != NULL) { + if (pref_autoaway_message) { int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(), RESOURCE_AWAY); @@ -618,7 +618,7 @@ ui_update_presence(const resource_presence_t resource_presence, contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence); title_bar_set_presence(contact_presence); gint priority = accounts_get_priority_for_presence_type(jabber_get_account_name(), resource_presence); - if (message != NULL) { + if (message) { cons_show("Status set to %s (priority %d), \"%s\".", show, priority, message); } else { cons_show("Status set to %s (priority %d).", show, priority); @@ -676,7 +676,7 @@ ui_handle_error(const char * const err_msg) void ui_invalid_command_usage(const char * const usage, void (*setting_func)(void)) { - if (setting_func != NULL) { + if (setting_func) { cons_show(""); (*setting_func)(); cons_show("Usage: %s", usage); @@ -733,7 +733,7 @@ ui_close_all_wins(void) GList *win_nums = wins_get_nums(); GList *curr = win_nums; - while (curr != NULL) { + while (curr) { int num = GPOINTER_TO_INT(curr->data); if ((num != 1) && (!ui_win_has_unsaved_form(num))) { if (conn_status == JABBER_CONNECTED) { @@ -760,7 +760,7 @@ ui_close_read_wins(void) GList *win_nums = wins_get_nums(); GList *curr = win_nums; - while (curr != NULL) { + while (curr) { int num = GPOINTER_TO_INT(curr->data); if ((num != 1) && (ui_win_unread(num) == 0) && (!ui_win_has_unsaved_form(num))) { if (conn_status == JABBER_CONNECTED) { @@ -784,7 +784,7 @@ ui_redraw_all_room_rosters(void) GList *win_nums = wins_get_nums(); GList *curr = win_nums; - while (curr != NULL) { + while (curr) { int num = GPOINTER_TO_INT(curr->data); ProfWin *window = wins_get_by_num(num); if (window->type == WIN_MUC && win_has_active_subwin(window)) { @@ -805,7 +805,7 @@ ui_hide_all_room_rosters(void) GList *win_nums = wins_get_nums(); GList *curr = win_nums; - while (curr != NULL) { + while (curr) { int num = GPOINTER_TO_INT(curr->data); ProfWin *window = wins_get_by_num(num); if (window->type == WIN_MUC && win_has_active_subwin(window)) { @@ -826,7 +826,7 @@ ui_show_all_room_rosters(void) GList *win_nums = wins_get_nums(); GList *curr = win_nums; - while (curr != NULL) { + while (curr) { int num = GPOINTER_TO_INT(curr->data); ProfWin *window = wins_get_by_num(num); if (window->type == WIN_MUC && !win_has_active_subwin(window)) { @@ -1112,12 +1112,12 @@ ui_prune_wins(void) gboolean pruned = FALSE; GSList *wins = wins_get_prune_wins(); - if (wins != NULL) { + if (wins) { pruned = TRUE; } GSList *curr = wins; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_CHAT) { if (conn_status == JABBER_CONNECTED) { @@ -1132,7 +1132,7 @@ ui_prune_wins(void) curr = g_slist_next(curr); } - if (wins != NULL) { + if (wins) { g_slist_free(wins); } @@ -1226,7 +1226,7 @@ ui_print_system_msg_from_recipient(const char * const barejid, const char *messa if (window == NULL) { int num = 0; window = wins_new_chat(barejid); - if (window != NULL) { + if (window) { num = wins_get_num(window); status_bar_active(num); } else { @@ -1258,8 +1258,8 @@ ui_recipient_gone(const char * const barejid, const char * const resource) if (show_message) { const char * display_usr = NULL; PContact contact = roster_get_contact(barejid); - if (contact != NULL) { - if (p_contact_name(contact) != NULL) { + if (contact) { + if (p_contact_name(contact)) { display_usr = p_contact_name(contact); } else { display_usr = barejid; @@ -1506,23 +1506,23 @@ ui_show_room_disco_info(const char * const roomjid, GSList *identities, GSList * { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { - if (((identities != NULL) && (g_slist_length(identities) > 0)) || - ((features != NULL) && (g_slist_length(features) > 0))) { - if (identities != NULL) { + if ((identities && (g_slist_length(identities) > 0)) || + (features && (g_slist_length(features) > 0))) { + if (identities) { win_print(window, '!', NULL, 0, 0, "", "Identities:"); } - while (identities != NULL) { + while (identities) { DiscoIdentity *identity = identities->data; // anme trpe, cat GString *identity_str = g_string_new(" "); - if (identity->name != NULL) { + if (identity->name) { identity_str = g_string_append(identity_str, identity->name); identity_str = g_string_append(identity_str, " "); } - if (identity->type != NULL) { + if (identity->type) { identity_str = g_string_append(identity_str, identity->type); identity_str = g_string_append(identity_str, " "); } - if (identity->category != NULL) { + if (identity->category) { identity_str = g_string_append(identity_str, identity->category); } win_print(window, '!', NULL, 0, 0, "", identity_str->str); @@ -1530,10 +1530,10 @@ ui_show_room_disco_info(const char * const roomjid, GSList *identities, GSList * identities = g_slist_next(identities); } - if (features != NULL) { + if (features) { win_print(window, '!', NULL, 0, 0, "", "Features:"); } - while (features != NULL) { + while (features) { win_vprint(window, '!', NULL, 0, 0, "", " %s", features->data); features = g_slist_next(features); } @@ -1563,14 +1563,14 @@ ui_room_roster(const char * const roomjid, GList *roster, const char * const pre win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%d %s: ", length, presence); } - while (roster != NULL) { + while (roster) { Occupant *occupant = roster->data; const char *presence_str = string_from_resource_presence(occupant->presence); theme_item_t presence_colour = theme_main_presence_attrs(presence_str); win_vprint(window, '!', NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", occupant->nick); - if (roster->next != NULL) { + if (roster->next) { win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", "); } @@ -1742,7 +1742,7 @@ ui_room_message(const char * const roomjid, const char * const nick, char *my_nick = muc_nick(roomjid); if (g_strcmp0(nick, my_nick) != 0) { - if (g_strrstr(message, my_nick) != NULL) { + if (g_strrstr(message, my_nick)) { win_print(window, '-', NULL, NO_ME, THEME_ROOMMENTION, nick, message); } else { win_print(window, '-', NULL, NO_ME, THEME_TEXT_THEM, nick, message); @@ -1787,7 +1787,7 @@ ui_room_message(const char * const roomjid, const char * const nick, if (g_strcmp0(room_setting, "mention") == 0) { char *message_lower = g_utf8_strdown(message, -1); char *nick_lower = g_utf8_strdown(nick, -1); - if (g_strrstr(message_lower, nick_lower) != NULL) { + if (g_strrstr(message_lower, nick_lower)) { notify = TRUE; } g_free(message_lower); @@ -2121,7 +2121,7 @@ int ui_win_unread(int index) { ProfWin *window = wins_get_by_num(index); - if (window != NULL) { + if (window) { return win_unread(window); } else { return 0; @@ -2144,7 +2144,7 @@ ui_chat_win_contact_online(PContact contact, Resource *resource, GDateTime *last const char *barejid = p_contact_barejid(contact); ProfWin *window = (ProfWin*)wins_get_chat(barejid); - if (window != NULL) { + if (window) { win_show_status_string(window, display_str, show, resource->status, last_activity, "++", "online"); @@ -2160,7 +2160,7 @@ ui_chat_win_contact_offline(PContact contact, char *resource, char *status) const char *barejid = p_contact_barejid(contact); ProfWin *window = (ProfWin*)wins_get_chat(barejid); - if (window != NULL) { + if (window) { win_show_status_string(window, display_str, "offline", status, NULL, "--", "offline"); } @@ -2175,7 +2175,7 @@ ui_contact_offline(char *barejid, char *resource, char *status) char *show_chat_win = prefs_get_string(PREF_STATUSES_CHAT); Jid *jid = jid_create_from_bare_and_resource(barejid, resource); PContact contact = roster_get_contact(barejid); - if (p_contact_subscription(contact) != NULL) { + if (p_contact_subscription(contact)) { if (strcmp(p_contact_subscription(contact), "none") != 0) { // show in console if "all" @@ -2256,7 +2256,7 @@ _ui_draw_term_title(void) if (res == -1) { log_error("Error writing terminal window title."); } - if (win_title != NULL) { + if (win_title) { free(win_title); } win_title = strdup(new_win_title); @@ -2408,9 +2408,9 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) case FIELD_HIDDEN: break; case FIELD_TEXT_SINGLE: - if (curr_value != NULL) { + if (curr_value) { char *value = curr_value->data; - if (value != NULL) { + if (value) { if (g_strcmp0(field->var, "muc#roomconfig_roomsecret") == 0) { win_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]"); } else { @@ -2421,9 +2421,9 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) win_newline(window); break; case FIELD_TEXT_PRIVATE: - if (curr_value != NULL) { + if (curr_value) { char *value = curr_value->data; - if (value != NULL) { + if (value) { win_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]"); } } @@ -2432,7 +2432,7 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) case FIELD_TEXT_MULTI: win_newline(window); int index = 1; - while (curr_value != NULL) { + while (curr_value) { char *value = curr_value->data; GString *val_tag = g_string_new(""); g_string_printf(val_tag, "val%d", index++); @@ -2458,12 +2458,12 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) } break; case FIELD_LIST_SINGLE: - if (curr_value != NULL) { + if (curr_value) { win_newline(window); char *value = curr_value->data; GSList *options = field->options; GSList *curr_option = options; - while (curr_option != NULL) { + while (curr_option) { FormOption *option = curr_option->data; if (g_strcmp0(option->value, value) == 0) { win_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " [%s] %s", option->value, option->label); @@ -2475,13 +2475,13 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) } break; case FIELD_LIST_MULTI: - if (curr_value != NULL) { + if (curr_value) { win_newline(window); GSList *options = field->options; GSList *curr_option = options; - while (curr_option != NULL) { + while (curr_option) { FormOption *option = curr_option->data; - if (g_slist_find_custom(curr_value, option->value, (GCompareFunc)g_strcmp0) != NULL) { + if (g_slist_find_custom(curr_value, option->value, (GCompareFunc)g_strcmp0)) { win_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " [%s] %s", option->value, option->label); } else { win_vprint(window, '-', NULL, 0, THEME_OFFLINE, "", " [%s] %s", option->value, option->label); @@ -2491,9 +2491,9 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) } break; case FIELD_JID_SINGLE: - if (curr_value != NULL) { + if (curr_value) { char *value = curr_value->data; - if (value != NULL) { + if (value) { win_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", value); } } @@ -2501,16 +2501,16 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) break; case FIELD_JID_MULTI: win_newline(window); - while (curr_value != NULL) { + while (curr_value) { char *value = curr_value->data; win_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " %s", value); curr_value = g_slist_next(curr_value); } break; case FIELD_FIXED: - if (curr_value != NULL) { + if (curr_value) { char *value = curr_value->data; - if (value != NULL) { + if (value) { win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", value); } } @@ -2525,7 +2525,7 @@ void ui_show_form(ProfMucConfWin *confwin) { ProfWin *window = (ProfWin*) confwin; - if (confwin->form->title != NULL) { + if (confwin->form->title) { win_print(window, '-', NULL, NO_EOL, 0, "", "Form title: "); win_print(window, '-', NULL, NO_DATE, 0, "", confwin->form->title); } else { @@ -2537,7 +2537,7 @@ ui_show_form(ProfMucConfWin *confwin) GSList *fields = confwin->form->fields; GSList *curr_field = fields; - while (curr_field != NULL) { + while (curr_field) { FormField *field = curr_field->data; if ((g_strcmp0(field->type, "fixed") == 0) && field->values) { @@ -2680,14 +2680,14 @@ ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) { ProfWin *window = (ProfWin*) confwin; FormField *field = form_get_field_by_tag(confwin->form, tag); - if (field != NULL) { + if (field) { win_print(window, '-', NULL, NO_EOL, 0, "", field->label); if (field->required) { win_print(window, '-', NULL, NO_DATE, 0, "", " (Required):"); } else { win_print(window, '-', NULL, NO_DATE, 0, "", ":"); } - if (field->description != NULL) { + if (field->description) { win_vprint(window, '-', NULL, 0, 0, "", " Description : %s", field->description); } win_vprint(window, '-', NULL, 0, 0, "", " Type : %s", field->type); @@ -2719,7 +2719,7 @@ ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) win_vprint(window, '-', NULL, 0, 0, "", " Set : /%s <value>", tag); win_print(window, '-', NULL, 0, 0, "", " Where : <value> is one of"); curr_option = field->options; - while (curr_option != NULL) { + while (curr_option) { option = curr_option->data; win_vprint(window, '-', NULL, 0, 0, "", " %s", option->value); curr_option = g_slist_next(curr_option); @@ -2730,7 +2730,7 @@ ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) win_vprint(window, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag); win_print(window, '-', NULL, 0, 0, "", " Where : <value> is one of"); curr_option = field->options; - while (curr_option != NULL) { + while (curr_option) { option = curr_option->data; win_vprint(window, '-', NULL, 0, 0, "", " %s", option->value); curr_option = g_slist_next(curr_option); @@ -2759,7 +2759,7 @@ ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) void ui_show_form_help(ProfMucConfWin *confwin) { - if (confwin->form->instructions != NULL) { + if (confwin->form->instructions) { ProfWin *window = (ProfWin*) confwin; win_print(window, '-', NULL, 0, 0, "", "Supplied instructions:"); win_print(window, '-', NULL, 0, 0, "", confwin->form->instructions); @@ -2770,7 +2770,7 @@ ui_show_form_help(ProfMucConfWin *confwin) void ui_show_lines(ProfWin *window, const gchar** lines) { - if (lines != NULL) { + if (lines) { int i; for (i = 0; lines[i] != NULL; i++) { win_print(window, '-', NULL, 0, 0, "", lines[i]); @@ -2833,7 +2833,7 @@ _win_show_history(ProfChatWin *chatwin, const char * const contact) GSList *history = chat_log_get_previous(jid->barejid, contact); jid_destroy(jid); GSList *curr = history; - while (curr != NULL) { + while (curr) { char *line = curr->data; // entry if (line[2] == ':') { diff --git a/src/ui/notifier.c b/src/ui/notifier.c index e8bc61e3..d3389bc5 100644 --- a/src/ui/notifier.c +++ b/src/ui/notifier.c @@ -89,7 +89,7 @@ notify_invite(const char * const from, const char * const room, g_string_append(message, from); g_string_append(message, "\nto: "); g_string_append(message, room); - if (reason != NULL) { + if (reason) { g_string_append_printf(message, "\n\"%s\"", reason); } @@ -103,7 +103,7 @@ notify_message(const char * const handle, int win, const char * const text) { GString *message = g_string_new(""); g_string_append_printf(message, "%s (win %d)", handle, win); - if (text != NULL) { + if (text) { g_string_append_printf(message, "\n%s", text); } @@ -117,7 +117,7 @@ notify_room_message(const char * const handle, const char * const room, int win, { GString *message = g_string_new(""); g_string_append_printf(message, "%s in %s (win %d)", handle, room, win); - if (text != NULL) { + if (text) { g_string_append_printf(message, "\n%s", text); } @@ -274,7 +274,7 @@ _notify(const char * const message, int timeout, app_id = "com.googlecode.iterm2"; } - if (app_id != NULL) { + if (app_id) { g_string_append(notify_command, " -sender "); g_string_append(notify_command, app_id); } diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 93eeaab0..581e63df 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -95,7 +95,7 @@ create_status_bar(void) mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket); wattroff(status_bar, bracket_attrs); - if (last_time != NULL) { + if (last_time) { g_date_time_unref(last_time); } last_time = g_date_time_new_now_local(); @@ -127,7 +127,7 @@ status_bar_resize(void) mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket); wattroff(status_bar, bracket_attrs); - if (message != NULL) { + if (message) { char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR); if (g_strcmp0(time_pref, "minutes") == 0) { mvwprintw(status_bar, 0, 10, message); @@ -137,7 +137,7 @@ status_bar_resize(void) mvwprintw(status_bar, 0, 1, message); } } - if (last_time != NULL) { + if (last_time) { g_date_time_unref(last_time); } last_time = g_date_time_new_now_local(); @@ -297,7 +297,7 @@ status_bar_print_message(const char * const msg) { werase(status_bar); - if (message != NULL) { + if (message) { free(message); } message = strdup(msg); @@ -325,7 +325,7 @@ status_bar_print_message(const char * const msg) void status_bar_clear(void) { - if (message != NULL) { + if (message) { free(message); message = NULL; } @@ -346,7 +346,7 @@ status_bar_clear(void) void status_bar_clear_message(void) { - if (message != NULL) { + if (message) { free(message); message = NULL; } @@ -428,7 +428,7 @@ _mark_inactive(int num) static void _status_bar_draw(void) { - if (last_time != NULL) { + if (last_time) { g_date_time_unref(last_time); } last_time = g_date_time_new_now_local(); diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index 08c9a8e6..9bb84f9d 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -80,7 +80,7 @@ title_bar_update_virtual(void) { ProfWin *window = wins_get_current(); if (window->type != WIN_CONSOLE) { - if (typing_elapsed != NULL) { + if (typing_elapsed) { gdouble seconds = g_timer_elapsed(typing_elapsed, NULL); if (seconds >= 10) { @@ -128,7 +128,7 @@ title_bar_set_presence(contact_presence_t presence) void title_bar_switch(void) { - if (typing_elapsed != NULL) { + if (typing_elapsed) { g_timer_destroy(typing_elapsed); typing_elapsed = NULL; typing = FALSE; @@ -141,7 +141,7 @@ void title_bar_set_typing(gboolean is_typing) { if (is_typing) { - if (typing_elapsed != NULL) { + if (typing_elapsed) { g_timer_start(typing_elapsed); } else { typing_elapsed = g_timer_new(); diff --git a/src/ui/window.c b/src/ui/window.c index 60c71802..9752ffda 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -573,7 +573,7 @@ win_show_contact(ProfWin *window, PContact contact) theme_item_t presence_colour = theme_main_presence_attrs(presence); - if (name != NULL) { + if (name) { win_print(window, '-', NULL, NO_EOL, presence_colour, "", name); } else { win_print(window, '-', NULL, NO_EOL, presence_colour, "", barejid); @@ -581,7 +581,7 @@ win_show_contact(ProfWin *window, PContact contact) win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence); - if (last_activity != NULL) { + if (last_activity) { GDateTime *now = g_date_time_new_now_local(); GTimeSpan span = g_date_time_difference(now, last_activity); @@ -599,7 +599,7 @@ win_show_contact(ProfWin *window, PContact contact) } } - if (status != NULL) { + if (status) { win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", p_contact_status(contact)); } @@ -637,41 +637,41 @@ win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occup if (caps) { // show identity - if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) { + if (caps->category || caps->type || caps->name) { win_print(window, '!', NULL, NO_EOL, 0, "", " Identity: "); - if (caps->name != NULL) { + if (caps->name) { win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", caps->name); - if ((caps->category != NULL) || (caps->type != NULL)) { + if (caps->category || caps->type) { win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); } } - if (caps->type != NULL) { + if (caps->type) { win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", caps->type); - if (caps->category != NULL) { + if (caps->category) { win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", " "); } } - if (caps->category != NULL) { + if (caps->category) { win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", caps->category); } win_newline(window); } - if (caps->software != NULL) { + if (caps->software) { win_vprint(window, '!', NULL, NO_EOL, 0, "", " Software: %s", caps->software); } - if (caps->software_version != NULL) { + if (caps->software_version) { win_vprint(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); } - if ((caps->software != NULL) || (caps->software_version != NULL)) { + if (caps->software || caps->software_version) { win_newline(window); } - if (caps->os != NULL) { + if (caps->os) { win_vprint(window, '!', NULL, NO_EOL, 0, "", " OS: %s", caps->os); } - if (caps->os_version != NULL) { + if (caps->os_version) { win_vprint(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); } - if ((caps->os != NULL) || (caps->os_version != NULL)) { + if (caps->os || caps->os_version) { win_newline(window); } caps_destroy(caps); @@ -693,16 +693,16 @@ win_show_info(ProfWin *window, PContact contact) win_print(window, '-', NULL, 0, 0, "", ""); win_print(window, '-', NULL, NO_EOL, presence_colour, "", barejid); - if (name != NULL) { + if (name) { win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (%s)", name); } win_print(window, '-', NULL, NO_DATE, 0, "", ":"); - if (sub != NULL) { + if (sub) { win_vprint(window, '-', NULL, 0, 0, "", "Subscription: %s", sub); } - if (last_activity != NULL) { + if (last_activity) { GDateTime *now = g_date_time_new_now_local(); GTimeSpan span = g_date_time_difference(now, last_activity); @@ -724,12 +724,12 @@ win_show_info(ProfWin *window, PContact contact) GList *resources = p_contact_get_available_resources(contact); GList *ordered_resources = NULL; - if (resources != NULL) { + if (resources) { win_print(window, '-', NULL, 0, 0, "", "Resources:"); // sort in order of availability GList *curr = resources; - while (curr != NULL) { + while (curr) { Resource *resource = curr->data; ordered_resources = g_list_insert_sorted(ordered_resources, resource, (GCompareFunc)resource_compare_availability); @@ -739,12 +739,12 @@ win_show_info(ProfWin *window, PContact contact) g_list_free(resources); GList *curr = ordered_resources; - while (curr != NULL) { + while (curr) { Resource *resource = curr->data; const char *resource_presence = string_from_resource_presence(resource->presence); theme_item_t presence_colour = theme_main_presence_attrs(resource_presence); win_vprint(window, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence); - if (resource->status != NULL) { + if (resource->status) { win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", resource->status); } win_newline(window); @@ -755,41 +755,41 @@ win_show_info(ProfWin *window, PContact contact) if (caps) { // show identity - if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) { + if (caps->category || caps->type || caps->name) { win_print(window, '-', NULL, NO_EOL, 0, "", " Identity: "); - if (caps->name != NULL) { + if (caps->name) { win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name); - if ((caps->category != NULL) || (caps->type != NULL)) { + if (caps->category || caps->type) { win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); } } - if (caps->type != NULL) { + if (caps->type) { win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type); - if (caps->category != NULL) { + if (caps->category) { win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); } } - if (caps->category != NULL) { + if (caps->category) { win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category); } win_newline(window); } - if (caps->software != NULL) { + if (caps->software) { win_vprint(window, '-', NULL, NO_EOL, 0, "", " Software: %s", caps->software); } - if (caps->software_version != NULL) { + if (caps->software_version) { win_vprint(window, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); } - if ((caps->software != NULL) || (caps->software_version != NULL)) { + if (caps->software || caps->software_version) { win_newline(window); } - if (caps->os != NULL) { + if (caps->os) { win_vprint(window, '-', NULL, NO_EOL, 0, "", " OS: %s", caps->os); } - if (caps->os_version != NULL) { + if (caps->os_version) { win_vprint(window, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); } - if ((caps->os != NULL) || (caps->os_version != NULL)) { + if (caps->os || caps->os_version) { win_newline(window); } caps_destroy(caps); @@ -808,7 +808,7 @@ win_show_status_string(ProfWin *window, const char * const from, { theme_item_t presence_colour; - if (show != NULL) { + if (show) { presence_colour = theme_main_presence_attrs(show); } else if (strcmp(default_show, "online") == 0) { presence_colour = THEME_ONLINE; @@ -819,12 +819,12 @@ win_show_status_string(ProfWin *window, const char * const from, win_vprint(window, '-', NULL, NO_EOL, presence_colour, "", "%s %s", pre, from); - if (show != NULL) + if (show) win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", show); else win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", default_show); - if (last_activity != NULL) { + if (last_activity) { GDateTime *now = g_date_time_new_now_local(); GTimeSpan span = g_date_time_difference(now, last_activity); g_date_time_unref(now); @@ -843,7 +843,7 @@ win_show_status_string(ProfWin *window, const char * const from, } } - if (status != NULL) + if (status) win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", status); win_print(window, '-', NULL, NO_DATE, presence_colour, "", ""); diff --git a/src/ui/windows.c b/src/ui/windows.c index 7a86403b..2334efc8 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -84,7 +84,7 @@ wins_get_chat(const char * const barejid) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_CHAT) { ProfChatWin *chatwin = (ProfChatWin*)window; @@ -106,7 +106,7 @@ wins_get_muc_conf(const char * const roomjid) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_MUC_CONFIG) { ProfMucConfWin *confwin = (ProfMucConfWin*)window; @@ -128,7 +128,7 @@ wins_get_muc(const char * const roomjid) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_MUC) { ProfMucWin *mucwin = (ProfMucWin*)window; @@ -150,7 +150,7 @@ wins_get_private(const char * const fulljid) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_PRIVATE) { ProfPrivateWin *privatewin = (ProfPrivateWin*)window; @@ -169,7 +169,7 @@ wins_get_private(const char * const fulljid) ProfWin * wins_get_current(void) { - if (windows != NULL) { + if (windows) { return g_hash_table_lookup(windows, GINT_TO_POINTER(current)); } else { return NULL; @@ -286,7 +286,7 @@ wins_get_next(void) GList *curr = keys; // find our place in the list - while (curr != NULL) { + while (curr) { if (current == GPOINTER_TO_INT(curr->data)) { break; } @@ -295,7 +295,7 @@ wins_get_next(void) // if there is a next window return it curr = g_list_next(curr); - if (curr != NULL) { + if (curr) { int next = GPOINTER_TO_INT(curr->data); g_list_free(keys); return wins_get_by_num(next); @@ -315,7 +315,7 @@ wins_get_previous(void) GList *curr = keys; // find our place in the list - while (curr != NULL) { + while (curr) { if (current == GPOINTER_TO_INT(curr->data)) { break; } @@ -324,7 +324,7 @@ wins_get_previous(void) // if there is a previous window return it curr = g_list_previous(curr); - if (curr != NULL) { + if (curr) { int previous = GPOINTER_TO_INT(curr->data); g_list_free(keys); return wins_get_by_num(previous); @@ -342,7 +342,7 @@ wins_get_num(ProfWin *window) GList *keys = g_hash_table_get_keys(windows); GList *curr = keys; - while (curr != NULL) { + while (curr) { gconstpointer num_p = curr->data; ProfWin *curr_win = g_hash_table_lookup(windows, num_p); if (curr_win == window) { @@ -468,7 +468,7 @@ wins_get_total_unread(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; result += win_unread(window); curr = g_list_next(curr); @@ -484,7 +484,7 @@ wins_resize_all(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; int subwin_cols = 0; @@ -564,7 +564,7 @@ wins_get_xmlconsole(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_XML) { ProfXMLWin *xmlwin = (ProfXMLWin*)window; @@ -586,7 +586,7 @@ wins_get_chat_recipients(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type == WIN_CHAT) { ProfChatWin *chatwin = (ProfChatWin*)window; @@ -605,7 +605,7 @@ wins_get_prune_wins(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (win_unread(window) == 0 && window->type != WIN_MUC && @@ -626,7 +626,7 @@ wins_lost_connection(void) GList *values = g_hash_table_get_values(windows); GList *curr = values; - while (curr != NULL) { + while (curr) { ProfWin *window = curr->data; if (window->type != WIN_CONSOLE) { win_print(window, '-', NULL, 0, THEME_ERROR, "", "Lost connection."); @@ -719,7 +719,7 @@ wins_tidy(void) int num = 1; GList *curr = keys; - while (curr != NULL) { + while (curr) { ProfWin *window = g_hash_table_lookup(windows, curr->data); if (num == 10) { g_hash_table_insert(new_windows, GINT_TO_POINTER(0), window); @@ -761,7 +761,7 @@ wins_create_summary(void) keys = g_list_sort(keys, cmp_win_num); GList *curr = keys; - while (curr != NULL) { + while (curr) { ProfWin *window = g_hash_table_lookup(windows, curr->data); int ui_index = GPOINTER_TO_INT(curr->data); |