comparison mcabber/src/screen.c @ 1311:0dda8238af21

Implement "/roster display"
author Mikael Berthe <mikael@lilotux.net>
date Thu, 13 Sep 2007 20:05:21 +0200
parents af035a304bec
children 248e3f69dd9e
comparison
equal deleted inserted replaced
1310:a5336c44d4e2 1311:0dda8238af21
2090 if (chatmode) 2090 if (chatmode)
2091 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, TRUE); 2091 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, TRUE);
2092 // We should rebuild the buddylist but not everytime 2092 // We should rebuild the buddylist but not everytime
2093 // Here we check if we were locking a buddy who is actually offline, 2093 // Here we check if we were locking a buddy who is actually offline,
2094 // and hide_offline_buddies is TRUE. In which case we need to rebuild. 2094 // and hide_offline_buddies is TRUE. In which case we need to rebuild.
2095 if (prev_st == offline && buddylist_get_hide_offline_buddies()) 2095 if (!(buddylist_get_filter() & 1<<prev_st))
2096 buddylist_build(); 2096 buddylist_build();
2097 update_roster = TRUE; 2097 update_roster = TRUE;
2098 } 2098 }
2099 2099
2100 // scr_RosterTop() 2100 // scr_RosterTop()
2245 if (!alternate_buddy || g_list_position(buddylist, alternate_buddy) == -1) 2245 if (!alternate_buddy || g_list_position(buddylist, alternate_buddy) == -1)
2246 return; 2246 return;
2247 set_current_buddy(alternate_buddy); 2247 set_current_buddy(alternate_buddy);
2248 if (chatmode) 2248 if (chatmode)
2249 scr_ShowBuddyWindow(); 2249 scr_ShowBuddyWindow();
2250 }
2251
2252 // scr_RosterDisplay(filter)
2253 // Set the roster filter mask. If filter is null/empty, the current
2254 // mask is displayed.
2255 void scr_RosterDisplay(const char *filter)
2256 {
2257 guchar status;
2258 enum imstatus budstate;
2259 char strfilter[imstatus_size+1];
2260 char *psfilter;
2261
2262 if (filter && *filter) {
2263 int show_all = (*filter == '*');
2264 status = 0;
2265 for (budstate = 0; budstate < imstatus_size-1; budstate++)
2266 if (strchr(filter, imstatus2char[budstate]) || show_all)
2267 status |= 1<<budstate;
2268 buddylist_set_filter(status);
2269 buddylist_build();
2270 update_roster = TRUE;
2271 return;
2272 }
2273
2274 // Display current filter
2275 psfilter = strfilter;
2276 status = buddylist_get_filter();
2277 for (budstate = 0; budstate < imstatus_size-1; budstate++)
2278 if (status & 1<<budstate)
2279 *psfilter++ = imstatus2char[budstate];
2280 *psfilter = '\0';
2281 scr_LogPrint(LPRINT_NORMAL, "Roster status filter: %s", strfilter);
2250 } 2282 }
2251 2283
2252 // scr_BufferScrollUpDown() 2284 // scr_BufferScrollUpDown()
2253 // Scroll up/down the current buddy window, 2285 // Scroll up/down the current buddy window,
2254 // - half a screen if nblines is 0, 2286 // - half a screen if nblines is 0,