Mercurial > hg
comparison mcabber/src/commands.c @ 1163:2913310a7be6
Make /roster bookmark in the status buffer show all bookmarks
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 17 Feb 2007 11:25:41 +0100 |
parents | 39b20ea22ce9 |
children | d5b26a0a9771 |
comparison
equal
deleted
inserted
replaced
1162:39b20ea22ce9 | 1163:2913310a7be6 |
---|---|
539 | 539 |
540 static void display_all_annotations(void) | 540 static void display_all_annotations(void) |
541 { | 541 { |
542 GSList *notes; | 542 GSList *notes; |
543 notes = jb_get_all_storage_rosternotes(); | 543 notes = jb_get_all_storage_rosternotes(); |
544 | |
545 if (!notes) | |
546 return; | |
547 | |
544 // Call display_and_free_note() for each note, | 548 // Call display_and_free_note() for each note, |
545 // with winId = NULL (special window) | 549 // with winId = NULL (special window) |
546 g_slist_foreach(notes, (GFunc)&display_and_free_note, NULL); | 550 g_slist_foreach(notes, (GFunc)&display_and_free_note, NULL); |
547 if (notes) { | 551 scr_setmsgflag_if_needed(SPECIAL_BUFFER_STATUS_ID, TRUE); |
548 scr_setmsgflag_if_needed(SPECIAL_BUFFER_STATUS_ID, TRUE); | 552 update_roster = TRUE; |
549 update_roster = TRUE; | |
550 } | |
551 g_slist_free(notes); | 553 g_slist_free(notes); |
552 } | 554 } |
553 | 555 |
554 static void roster_note(char *arg) | 556 static void roster_note(char *arg) |
555 { | 557 { |
2261 nick = buddy_getnickname(bud); | 2263 nick = buddy_getnickname(bud); |
2262 } | 2264 } |
2263 | 2265 |
2264 jb_set_storage_bookmark(roomid, name, nick, NULL, autojoin); | 2266 jb_set_storage_bookmark(roomid, name, nick, NULL, autojoin); |
2265 } | 2267 } |
2268 | |
2269 static void display_all_bookmarks(void) | |
2270 { | |
2271 GSList *bm, *bmp; | |
2272 GString *sbuf; | |
2273 | |
2274 bm = jb_get_all_storage_bookmarks(); | |
2275 | |
2276 if (!bm) | |
2277 return; | |
2278 | |
2279 sbuf = g_string_new(""); | |
2280 | |
2281 scr_WriteIncomingMessage(NULL, "List of MUC bookmarks:", 0, HBB_PREFIX_INFO); | |
2282 | |
2283 for (bmp = bm; bmp; bmp = g_slist_next(bmp)) { | |
2284 g_string_printf(sbuf, "<%s>", (char*)bmp->data); | |
2285 scr_WriteIncomingMessage(NULL, sbuf->str, 0, HBB_PREFIX_NONE); | |
2286 } | |
2287 | |
2288 scr_setmsgflag_if_needed(SPECIAL_BUFFER_STATUS_ID, TRUE); | |
2289 update_roster = TRUE; | |
2290 g_string_free(sbuf, TRUE); | |
2291 g_slist_free(bm); | |
2292 } | |
2293 | |
2266 | 2294 |
2267 static void do_room(char *arg) | 2295 static void do_room(char *arg) |
2268 { | 2296 { |
2269 char **paramlst; | 2297 char **paramlst; |
2270 char *subcmd; | 2298 char *subcmd; |
2341 room_topic(bud, arg); | 2369 room_topic(bud, arg); |
2342 } else if (!strcasecmp(subcmd, "whois")) { | 2370 } else if (!strcasecmp(subcmd, "whois")) { |
2343 if ((arg = check_room_subcommand(arg, TRUE, bud)) != NULL) | 2371 if ((arg = check_room_subcommand(arg, TRUE, bud)) != NULL) |
2344 room_whois(bud, arg, TRUE); | 2372 room_whois(bud, arg, TRUE); |
2345 } else if (!strcasecmp(subcmd, "bookmark")) { | 2373 } else if (!strcasecmp(subcmd, "bookmark")) { |
2346 if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL) | 2374 if (!arg && !buddy_getjid(BUDDATA(current_buddy)) && |
2375 buddy_gettype(BUDDATA(current_buddy)) == ROSTER_TYPE_SPECIAL) | |
2376 display_all_bookmarks(); | |
2377 else if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL) | |
2347 room_bookmark(bud, arg); | 2378 room_bookmark(bud, arg); |
2348 } else { | 2379 } else { |
2349 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); | 2380 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); |
2350 } | 2381 } |
2351 | 2382 |