comparison mcabber/src/commands.c @ 1573:ece4f26bf9ff

Add count parameter to roster up/down command (Based on a patch from knyar in the issue tracker)
author Mikael Berthe <mikael@lilotux.net>
date Mon, 13 Apr 2009 00:26:56 +0200
parents 248da27faff3
children 0a1f59dc503d
comparison
equal deleted inserted replaced
1572:8c0237c8c186 1573:ece4f26bf9ff
631 HBB_PREFIX_INFO, 0); 631 HBB_PREFIX_INFO, 0);
632 } 632 }
633 } 633 }
634 } 634 }
635 635
636 // roster_updown(updown, nitems)
637 // updown: -1=up, +1=down
638 inline static void roster_updown(int updown, char *nitems)
639 {
640 int nbitems;
641
642 if (!nitems || !*nitems)
643 nbitems = 1;
644 else
645 nbitems = strtol(nitems, NULL, 10);
646
647 if (nbitems > 0)
648 scr_RosterUpDown(updown, nbitems);
649 }
650
636 /* Commands callback functions */ 651 /* Commands callback functions */
637 /* All these do_*() functions will be called with a "arg" parameter */ 652 /* All these do_*() functions will be called with a "arg" parameter */
638 /* (with arg not null) */ 653 /* (with arg not null) */
639 654
640 static void do_roster(char *arg) 655 static void do_roster(char *arg)
699 return; 714 return;
700 } 715 }
701 scr_RosterSearch(arg); 716 scr_RosterSearch(arg);
702 update_roster = TRUE; 717 update_roster = TRUE;
703 } else if (!strcasecmp(subcmd, "up")) { 718 } else if (!strcasecmp(subcmd, "up")) {
704 scr_RosterUp(); 719 roster_updown(-1, arg);
705 } else if (!strcasecmp(subcmd, "down")) { 720 } else if (!strcasecmp(subcmd, "down")) {
706 scr_RosterDown(); 721 roster_updown(1, arg);
707 } else if (!strcasecmp(subcmd, "group_prev")) { 722 } else if (!strcasecmp(subcmd, "group_prev")) {
708 scr_RosterPrevGroup(); 723 scr_RosterPrevGroup();
709 } else if (!strcasecmp(subcmd, "group_next")) { 724 } else if (!strcasecmp(subcmd, "group_next")) {
710 scr_RosterNextGroup(); 725 scr_RosterNextGroup();
711 } else if (!strcasecmp(subcmd, "note")) { 726 } else if (!strcasecmp(subcmd, "note")) {
1532 int nblines; 1547 int nblines;
1533 1548
1534 if (!nlines || !*nlines) 1549 if (!nlines || !*nlines)
1535 nblines = 0; 1550 nblines = 0;
1536 else 1551 else
1537 nblines = atoi(nlines); 1552 nblines = strtol(nlines, NULL, 10);
1538 1553
1539 if (nblines >= 0) 1554 if (nblines >= 0)
1540 scr_BufferScrollUpDown(updown, nblines); 1555 scr_BufferScrollUpDown(updown, nblines);
1541 } 1556 }
1542 1557
1932 if (type & ROSTER_TYPE_GROUP) { 1947 if (type & ROSTER_TYPE_GROUP) {
1933 // Rename a whole group 1948 // Rename a whole group
1934 foreach_group_member(bud, &move_group_member, name_utf8); 1949 foreach_group_member(bud, &move_group_member, name_utf8);
1935 // Let's jump to the previous buddy, because this group name should 1950 // Let's jump to the previous buddy, because this group name should
1936 // disappear when we receive the server answer. 1951 // disappear when we receive the server answer.
1937 scr_RosterUp(); 1952 scr_RosterUpDown(-1, 1);
1938 } else { 1953 } else {
1939 // Rename a single buddy 1954 // Rename a single buddy
1940 guint del_name = 0; 1955 guint del_name = 0;
1941 if (!*newname || !strcmp(arg, "-")) 1956 if (!*newname || !strcmp(arg, "-"))
1942 del_name = TRUE; 1957 del_name = TRUE;
1986 group_utf8 = to_utf8(newgroupname); 2001 group_utf8 = to_utf8(newgroupname);
1987 if (strcmp(oldgroupname, group_utf8)) { 2002 if (strcmp(oldgroupname, group_utf8)) {
1988 guint msgflag; 2003 guint msgflag;
1989 2004
1990 jb_updatebuddy(bjid, name, *group_utf8 ? group_utf8 : NULL); 2005 jb_updatebuddy(bjid, name, *group_utf8 ? group_utf8 : NULL);
1991 scr_RosterUp(); 2006 scr_RosterUpDown(-1, 1);
1992 2007
1993 // If the buddy has a pending message flag, 2008 // If the buddy has a pending message flag,
1994 // we remove it temporarily in order to reset the global group 2009 // we remove it temporarily in order to reset the global group
1995 // flag. We set it back once the buddy is in the new group, 2010 // flag. We set it back once the buddy is in the new group,
1996 // which will update the new group's flag. 2011 // which will update the new group's flag.