diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/channel-rec.h | 1 | ||||
-rw-r--r-- | src/core/nicklist.c | 38 | ||||
-rw-r--r-- | src/core/query-rec.h | 1 | ||||
-rw-r--r-- | src/core/window-item-rec.h | 2 | ||||
-rw-r--r-- | src/fe-common/core/fe-modules.c | 19 | ||||
-rw-r--r-- | src/fe-common/core/keyboard.c | 8 | ||||
-rw-r--r-- | src/fe-common/core/window-items.c | 10 | ||||
-rw-r--r-- | src/fe-text/statusbar-config.c | 2 |
8 files changed, 34 insertions, 47 deletions
diff --git a/src/core/channel-rec.h b/src/core/channel-rec.h index 7b806ca4..f3ec5f8d 100644 --- a/src/core/channel-rec.h +++ b/src/core/channel-rec.h @@ -2,7 +2,6 @@ #include "window-item-rec.h" -char *name; char *topic; char *topic_by; time_t topic_time; diff --git a/src/core/nicklist.c b/src/core/nicklist.c index d6590261..a5f25f34 100644 --- a/src/core/nicklist.c +++ b/src/core/nicklist.c @@ -281,40 +281,26 @@ GSList *nicklist_getnicks(CHANNEL_REC *channel) return list; } -typedef struct { - CHANNEL_REC *channel; - const char *nick; - GSList *list; -} NICKLIST_GET_SAME_REC; - -static void get_nicks_same_hash(gpointer key, NICK_REC *nick, - NICKLIST_GET_SAME_REC *rec) -{ - while (nick != NULL) { - if (g_ascii_strcasecmp(nick->nick, rec->nick) == 0) { - rec->list = g_slist_append(rec->list, rec->channel); - rec->list = g_slist_append(rec->list, nick); - } - - nick = nick->next; - } -} - GSList *nicklist_get_same(SERVER_REC *server, const char *nick) { - NICKLIST_GET_SAME_REC rec; GSList *tmp; + GSList *list = NULL; g_return_val_if_fail(IS_SERVER(server), NULL); - rec.nick = nick; - rec.list = NULL; for (tmp = server->channels; tmp != NULL; tmp = tmp->next) { - rec.channel = tmp->data; - g_hash_table_foreach(rec.channel->nicks, - (GHFunc) get_nicks_same_hash, &rec); + NICK_REC *nick_rec; + CHANNEL_REC *channel = tmp->data; + + for (nick_rec = g_hash_table_lookup(channel->nicks, nick); + nick_rec != NULL; + nick_rec = nick_rec->next) { + list = g_slist_append(list, channel); + list = g_slist_append(list, nick_rec); + } } - return rec.list; + + return list; } typedef struct { diff --git a/src/core/query-rec.h b/src/core/query-rec.h index ddb85ba4..fc08d2ef 100644 --- a/src/core/query-rec.h +++ b/src/core/query-rec.h @@ -2,7 +2,6 @@ #include "window-item-rec.h" -char *name; char *address; char *server_tag; time_t last_unread_msg; diff --git a/src/core/window-item-rec.h b/src/core/window-item-rec.h index d7b6f7db..7bf5ba5f 100644 --- a/src/core/window-item-rec.h +++ b/src/core/window-item-rec.h @@ -7,7 +7,7 @@ GHashTable *module_data; void *window; STRUCT_SERVER_REC *server; char *visible_name; - +char *name; time_t createtime; int data_level; char *hilight_color; diff --git a/src/fe-common/core/fe-modules.c b/src/fe-common/core/fe-modules.c index 4a13f668..df97ceb1 100644 --- a/src/fe-common/core/fe-modules.c +++ b/src/fe-common/core/fe-modules.c @@ -195,6 +195,8 @@ static void cmd_unload(const char *data) MODULE_FILE_REC *file; char *rootmodule, *submodule; void *free_arg; + GSList *tmp; + int all_dynamic; g_return_if_fail(data != NULL); @@ -204,14 +206,21 @@ static void cmd_unload(const char *data) module = module_find(rootmodule); if (module != NULL) { - if (*submodule == '\0') - module_unload(module); + if (*submodule == '\0') { + all_dynamic = 1; + for (tmp = module->files; tmp != NULL; tmp = tmp->next) + all_dynamic &= !MODULE_IS_STATIC((MODULE_FILE_REC*) tmp->data); + if (all_dynamic) + module_unload(module); + } else { file = module_file_find(module, submodule); - if (file != NULL) - module_file_unload(file); + if (file != NULL) { + if (!MODULE_IS_STATIC(file)) + module_file_unload(file); + } else - module = NULL; + module = NULL; } } diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 67a8d09b..00454401 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -374,8 +374,8 @@ static void key_states_rescan(void) memset(used_keys, 0, sizeof(used_keys)); - g_tree_traverse(key_states, (GTraverseFunc) key_state_destroy, - G_IN_ORDER, NULL); + g_tree_foreach(key_states, (GTraverseFunc) key_state_destroy, + NULL); g_tree_destroy(key_states); key_states = g_tree_new((GCompareFunc) strcmp); @@ -884,8 +884,8 @@ void keyboard_deinit(void) g_hash_table_destroy(keys); g_hash_table_destroy(default_keys); - g_tree_traverse(key_states, (GTraverseFunc) key_state_destroy, - G_IN_ORDER, NULL); + g_tree_foreach(key_states, (GTraverseFunc) key_state_destroy, + NULL); g_tree_destroy(key_states); signal_remove("irssi init read settings", (SIGNAL_FUNC) read_keyboard_config); diff --git a/src/fe-common/core/window-items.c b/src/fe-common/core/window-items.c index 303a80db..c29db9e6 100644 --- a/src/fe-common/core/window-items.c +++ b/src/fe-common/core/window-items.c @@ -218,16 +218,10 @@ WI_ITEM_REC *window_item_find_window(WINDOW_REC *window, WI_ITEM_REC *rec = tmp->data; if ((server == NULL || rec->server == server) && - g_ascii_strcasecmp(name, rec->visible_name) == 0) + (g_ascii_strcasecmp(name, rec->visible_name) == 0 + || (rec->name && g_ascii_strcasecmp(name, rec->name) == 0))) return rec; } - - /* try with channel name too, it's not necessarily - same as visible_name (!channels) */ - channel = channel_find(server, name); - if (channel != NULL && window_item_window(channel) == window) - return (WI_ITEM_REC *) channel; - return NULL; } diff --git a/src/fe-text/statusbar-config.c b/src/fe-text/statusbar-config.c index 013ce062..deaa1b5d 100644 --- a/src/fe-text/statusbar-config.c +++ b/src/fe-text/statusbar-config.c @@ -338,7 +338,7 @@ static void cmd_statusbar_print_info(const char *name) for (; tmp != NULL; tmp = tmp->next) { STATUSBAR_CONFIG_REC *rec = tmp->data; - if (g_strcasecmp(rec->name, name) == 0) { + if (g_ascii_strcasecmp(rec->name, name) == 0) { statusbar_print(rec); return; } |