Changeset 5c90890
- Timestamp:
- 2018-07-12T08:54:12Z (6 years ago)
- Branches:
- master
- Children:
- c82e4ca
- Parents:
- b9d1fdc
- git-author:
- dequis <dx@…> (03-07-18 06:17:17)
- git-committer:
- dequis <dx@…> (12-07-18 08:54:12)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.c
rb9d1fdc r5c90890 242 242 { 243 243 GSList *l; 244 GHashTableIter iter; 245 gpointer itervalue; 244 246 245 247 irc->status |= USTATUS_SHUTDOWN; … … 271 273 bee_free(irc->b); 272 274 273 while (irc->users) { 274 irc_user_free(irc, (irc_user_t *) irc->users->data); 275 g_hash_table_iter_init(&iter, irc->nick_user_hash); 276 277 while (g_hash_table_iter_next(&iter, NULL, &itervalue)) { 278 g_hash_table_iter_remove(&iter); 279 irc_user_free(irc, (irc_user_t *) itervalue); 275 280 } 276 281 … … 292 297 irc->fd = -1; 293 298 294 g_hash_table_foreach_remove(irc->nick_user_hash, irc_free_hashkey, NULL);295 299 g_hash_table_destroy(irc->nick_user_hash); 296 300 -
irc.h
rb9d1fdc r5c90890 102 102 GSList *file_transfers; 103 103 104 GSList *users, *channels; 104 GSList *users G_GNUC_DEPRECATED; 105 GSList *channels; 105 106 struct irc_channel *default_channel; 106 107 GHashTable *nick_user_hash; -
irc_channel.c
rb9d1fdc r5c90890 121 121 { 122 122 irc_t *irc; 123 GSList *l; 123 GHashTableIter iter; 124 gpointer itervalue; 124 125 125 126 if (ic == NULL) { … … 146 147 } 147 148 148 for (l = irc->users; l; l = l->next) { 149 irc_user_t *iu = l->data; 149 g_hash_table_iter_init(&iter, irc->nick_user_hash); 150 151 while (g_hash_table_iter_next(&iter, NULL, &itervalue)) { 152 irc_user_t *iu = itervalue; 150 153 151 154 if (iu->last_channel == ic) { … … 729 732 } 730 733 } else if (g_strcasecmp(set_getstr(&irc->b->set, "default_target"), "last") == 0 && 731 ic->last_target && g_ slist_find(irc->users, ic->last_target)) {734 ic->last_target && g_hash_table_contains(irc->nick_user_hash, ic->last_target->key)) { 732 735 iu = ic->last_target; 733 736 } else { -
irc_commands.c
rb9d1fdc r5c90890 449 449 450 450 if (!channel || *channel == '0' || *channel == '*' || !*channel) { 451 irc_send_who(irc, irc->users, "**"); 451 GList *all_users = g_hash_table_get_values(irc->nick_user_hash); 452 irc_send_who(irc, (GSList *) all_users, "**"); 453 g_list_free(all_users); 452 454 } else if ((ic = irc_channel_by_name(irc, channel))) { 453 455 irc_send_who(irc, ic->users, channel); -
irc_im.c
rb9d1fdc r5c90890 181 181 } 182 182 if (iu == NULL) { 183 for (l = irc->users; l; l = l->next) { 184 iu = l->data; 183 GHashTableIter iter; 184 gpointer itervalue; 185 g_hash_table_iter_init(&iter, irc->nick_user_hash); 186 187 while (g_hash_table_iter_next(&iter, NULL, &itervalue)) { 188 iu = itervalue; 185 189 if (iu->bu) { 186 bee_irc_channel_update(irc, ic, l->data);190 bee_irc_channel_update(irc, ic, iu); 187 191 } 188 192 } -
irc_user.c
rb9d1fdc r5c90890 37 37 iu->key = g_strdup(nick); 38 38 nick_lc(irc, iu->key); 39 /* Using the hash table for speed and irc->users for easy iteration40 through the list (since the GLib API doesn't have anything sane41 for that.) */42 39 g_hash_table_insert(irc->nick_user_hash, iu->key, iu); 43 irc->users = g_slist_insert_sorted(irc->users, iu, irc_user_cmp);44 40 45 41 return iu; … … 87 83 irc_user_quit(iu, msg); 88 84 89 irc->users = g_slist_remove(irc->users, iu);90 85 g_hash_table_remove(irc->nick_user_hash, iu->key); 91 86 … … 148 143 } 149 144 150 irc->users = g_slist_remove(irc->users, iu);151 145 g_hash_table_remove(irc->nick_user_hash, iu->key); 152 146 … … 175 169 iu->key = g_strdup(key); 176 170 g_hash_table_insert(irc->nick_user_hash, iu->key, iu); 177 irc->users = g_slist_insert_sorted(irc->users, iu, irc_user_cmp);178 171 179 172 if (iu == irc->user) { -
root_commands.c
rb9d1fdc r5c90890 773 773 bu->ic->acc->prpl->remove_buddy(bu->ic, bu->handle, NULL); 774 774 nick_del(bu); 775 if (g_ slist_find(irc->users, iu)) {775 if (g_hash_table_contains(irc->nick_user_hash, iu->key)) { 776 776 bee_user_free(irc->b, bu); 777 777 } … … 1033 1033 { 1034 1034 int online = 0, away = 0, offline = 0, ismatch = 0; 1035 G SList *l;1035 GList *l, *users; 1036 1036 GRegex *regex = NULL; 1037 1037 GError *error = NULL; … … 1074 1074 } 1075 1075 1076 for (l = irc->users; l; l = l->next) { 1076 users = g_hash_table_get_values(irc->nick_user_hash); 1077 users = g_list_sort(users, irc_user_cmp); 1078 1079 for (l = users; l; l = l->next) { 1077 1080 irc_user_t *iu = l->data; 1078 1081 bee_user_t *bu = iu->bu; … … 1119 1122 } 1120 1123 } 1124 1125 g_list_free(users); 1121 1126 1122 1127 irc_rootmsg(irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online,
Note: See TracChangeset
for help on using the changeset viewer.