Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/commands.c @ 1350:096411233fce
Add /roster item_toggle_lock (suggested by Wolfram S.)
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 10 Nov 2007 22:14:57 +0100 |
parents | 07816313073b |
children | 43e777a5ff06 |
comparison
equal
deleted
inserted
replaced
1349:1a82a0a87fc7 | 1350:096411233fce |
---|---|
182 compl_add_category_word(COMPL_ROSTER, "hide_offline"); | 182 compl_add_category_word(COMPL_ROSTER, "hide_offline"); |
183 compl_add_category_word(COMPL_ROSTER, "show_offline"); | 183 compl_add_category_word(COMPL_ROSTER, "show_offline"); |
184 compl_add_category_word(COMPL_ROSTER, "toggle_offline"); | 184 compl_add_category_word(COMPL_ROSTER, "toggle_offline"); |
185 compl_add_category_word(COMPL_ROSTER, "item_lock"); | 185 compl_add_category_word(COMPL_ROSTER, "item_lock"); |
186 compl_add_category_word(COMPL_ROSTER, "item_unlock"); | 186 compl_add_category_word(COMPL_ROSTER, "item_unlock"); |
187 compl_add_category_word(COMPL_ROSTER, "item_toggle_lock"); | |
187 compl_add_category_word(COMPL_ROSTER, "alternate"); | 188 compl_add_category_word(COMPL_ROSTER, "alternate"); |
188 compl_add_category_word(COMPL_ROSTER, "search"); | 189 compl_add_category_word(COMPL_ROSTER, "search"); |
189 compl_add_category_word(COMPL_ROSTER, "unread_first"); | 190 compl_add_category_word(COMPL_ROSTER, "unread_first"); |
190 compl_add_category_word(COMPL_ROSTER, "unread_next"); | 191 compl_add_category_word(COMPL_ROSTER, "unread_next"); |
191 compl_add_category_word(COMPL_ROSTER, "note"); | 192 compl_add_category_word(COMPL_ROSTER, "note"); |
455 | 456 |
456 /* It is _probably_ a command -- except for verbatim multi-line mode */ | 457 /* It is _probably_ a command -- except for verbatim multi-line mode */ |
457 return process_command(line, FALSE); | 458 return process_command(line, FALSE); |
458 } | 459 } |
459 | 460 |
460 // Helper routine for buffer item_{lock,unlock} | 461 // Helper routine for buffer item_{lock,unlock,toggle_lock} |
461 static void roster_buddylock(char *bjid, bool lock) | 462 // "lock" values: 1=lock 0=unlock -1=invert |
463 static void roster_buddylock(char *bjid, int lock) | |
462 { | 464 { |
463 gpointer bud = NULL; | 465 gpointer bud = NULL; |
464 bool may_need_refresh = FALSE; | 466 bool may_need_refresh = FALSE; |
465 | 467 |
466 // Allow special jid "" or "." (current buddy) | 468 // Allow special jid "" or "." (current buddy) |
489 bud = BUDDATA(current_buddy); | 491 bud = BUDDATA(current_buddy); |
490 } | 492 } |
491 | 493 |
492 // Update the ROSTER_FLAG_USRLOCK flag | 494 // Update the ROSTER_FLAG_USRLOCK flag |
493 if (bud) { | 495 if (bud) { |
496 if (lock == -1) | |
497 lock = !(buddy_getflags(bud) & ROSTER_FLAG_USRLOCK); | |
494 buddy_setflags(bud, ROSTER_FLAG_USRLOCK, lock); | 498 buddy_setflags(bud, ROSTER_FLAG_USRLOCK, lock); |
495 if (may_need_refresh) | 499 if (may_need_refresh) { |
496 buddylist_build(); | 500 buddylist_build(); |
497 update_roster = TRUE; | 501 update_roster = TRUE; |
502 } | |
498 } | 503 } |
499 } | 504 } |
500 | 505 |
501 // display_and_free_note(note, winId) | 506 // display_and_free_note(note, winId) |
502 // Display the note information in the winId buffer, and free note | 507 // Display the note information in the winId buffer, and free note |
655 buddylist_build(); | 660 buddylist_build(); |
656 update_roster = TRUE; | 661 update_roster = TRUE; |
657 } else if (!strcasecmp(subcmd, "display")) { | 662 } else if (!strcasecmp(subcmd, "display")) { |
658 scr_RosterDisplay(arg); | 663 scr_RosterDisplay(arg); |
659 } else if (!strcasecmp(subcmd, "item_lock")) { | 664 } else if (!strcasecmp(subcmd, "item_lock")) { |
660 roster_buddylock(arg, TRUE); | 665 roster_buddylock(arg, 1); |
661 } else if (!strcasecmp(subcmd, "item_unlock")) { | 666 } else if (!strcasecmp(subcmd, "item_unlock")) { |
662 roster_buddylock(arg, FALSE); | 667 roster_buddylock(arg, 0); |
668 } else if (!strcasecmp(subcmd, "item_toggle_lock")) { | |
669 roster_buddylock(arg, -1); | |
663 } else if (!strcasecmp(subcmd, "unread_first")) { | 670 } else if (!strcasecmp(subcmd, "unread_first")) { |
664 scr_RosterUnreadMessage(0); | 671 scr_RosterUnreadMessage(0); |
665 } else if (!strcasecmp(subcmd, "unread_next")) { | 672 } else if (!strcasecmp(subcmd, "unread_next")) { |
666 scr_RosterUnreadMessage(1); | 673 scr_RosterUnreadMessage(1); |
667 } else if (!strcasecmp(subcmd, "alternate")) { | 674 } else if (!strcasecmp(subcmd, "alternate")) { |