comparison mcabber/mcabber/roster.c @ 1996:7837d5a3f509

Going back to the first buddy with /roster next_unread when there is no more unread messages.
author Simon Jacquin
date Sun, 22 May 2011 23:30:37 +0200
parents 6febc7d1f760
children 8dc418af3e72
comparison
equal deleted inserted replaced
1995:7f7c6b87f1b1 1996:7837d5a3f509
125 static GSList *unread_list; 125 static GSList *unread_list;
126 static GHashTable *unread_jids; 126 static GHashTable *unread_jids;
127 GList *buddylist; 127 GList *buddylist;
128 GList *current_buddy; 128 GList *current_buddy;
129 GList *alternate_buddy; 129 GList *alternate_buddy;
130 GList *last_activity_buddy;
130 131
131 static roster roster_special; 132 static roster roster_special;
132 133
133 static int unread_jid_del(const char *jid); 134 static int unread_jid_del(const char *jid);
134 135
958 { 959 {
959 GSList *sl_roster_elt = groups; 960 GSList *sl_roster_elt = groups;
960 roster *roster_elt; 961 roster *roster_elt;
961 roster *roster_current_buddy = NULL; 962 roster *roster_current_buddy = NULL;
962 roster *roster_alternate_buddy = NULL; 963 roster *roster_alternate_buddy = NULL;
964 roster *roster_last_activity_buddy = NULL;
963 int shrunk_group; 965 int shrunk_group;
964 966
965 // We need to remember which buddy is selected. 967 // We need to remember which buddy is selected.
966 if (current_buddy) 968 if (current_buddy)
967 roster_current_buddy = BUDDATA(current_buddy); 969 roster_current_buddy = BUDDATA(current_buddy);
968 current_buddy = NULL; 970 current_buddy = NULL;
969 if (alternate_buddy) 971 if (alternate_buddy)
970 roster_alternate_buddy = BUDDATA(alternate_buddy); 972 roster_alternate_buddy = BUDDATA(alternate_buddy);
971 alternate_buddy = NULL; 973 alternate_buddy = NULL;
974 if (last_activity_buddy)
975 roster_last_activity_buddy = BUDDATA(last_activity_buddy);
976 last_activity_buddy = NULL;
972 977
973 // Destroy old buddylist 978 // Destroy old buddylist
974 if (buddylist) { 979 if (buddylist) {
975 g_list_free(buddylist); 980 g_list_free(buddylist);
976 buddylist = NULL; 981 buddylist = NULL;
1024 // Check if we can find our saved current_buddy... 1029 // Check if we can find our saved current_buddy...
1025 if (roster_current_buddy) 1030 if (roster_current_buddy)
1026 current_buddy = g_list_find(buddylist, roster_current_buddy); 1031 current_buddy = g_list_find(buddylist, roster_current_buddy);
1027 if (roster_alternate_buddy) 1032 if (roster_alternate_buddy)
1028 alternate_buddy = g_list_find(buddylist, roster_alternate_buddy); 1033 alternate_buddy = g_list_find(buddylist, roster_alternate_buddy);
1034 if (roster_last_activity_buddy)
1035 last_activity_buddy = g_list_find(buddylist, roster_last_activity_buddy);
1029 // current_buddy initialization 1036 // current_buddy initialization
1030 if (!current_buddy || (g_list_position(buddylist, current_buddy) == -1)) 1037 if (!current_buddy || (g_list_position(buddylist, current_buddy) == -1))
1031 current_buddy = g_list_first(buddylist); 1038 current_buddy = g_list_first(buddylist);
1032 } 1039 }
1033 1040