diff mcabber/src/screen.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 d64e0b2855fc
children a2dd83167bc9
line wrap: on
line diff
--- a/mcabber/src/screen.c	Sat Apr 11 12:30:51 2009 +0200
+++ b/mcabber/src/screen.c	Mon Apr 13 00:26:56 2009 +0200
@@ -2253,20 +2253,20 @@
     scr_ShowBuddyWindow();
 }
 
-//  scr_RosterUp()
-// Go to the previous buddy in the buddylist
-void scr_RosterUp(void)
+//  scr_RosterUpDown(updown, n)
+// Go to the nth next buddy in the buddylist
+// (up if updown == -1, down if updown == 1)
+void scr_RosterUpDown(int updown, unsigned int n)
 {
-  set_current_buddy(g_list_previous(current_buddy));
-  if (chatmode)
-    scr_ShowBuddyWindow();
-}
-
-//  scr_RosterDown()
-// Go to the next buddy in the buddylist
-void scr_RosterDown(void)
-{
-  set_current_buddy(g_list_next(current_buddy));
+  unsigned int i;
+
+  if (updown < 0) {
+    for (i = 0; i < n; i++)
+      set_current_buddy(g_list_previous(current_buddy));
+  } else {
+    for (i = 0; i < n; i++)
+      set_current_buddy(g_list_next(current_buddy));
+  }
   if (chatmode)
     scr_ShowBuddyWindow();
 }