diff mcabber/src/screen.c @ 480:882e1acae422

Add /say_to command
author Mikael Berthe <mikael@lilotux.net>
date Tue, 04 Oct 2005 19:47:50 +0200
parents e4840b288be0
children baa812f04f24
line wrap: on
line diff
--- a/mcabber/src/screen.c	Mon Oct 03 23:59:56 2005 +0200
+++ b/mcabber/src/screen.c	Tue Oct 04 19:47:50 2005 +0200
@@ -777,8 +777,8 @@
   doupdate();
 }
 
-void scr_WriteMessage(const char *jid, const char *text, time_t timestamp,
-        guint prefix_flags)
+inline void scr_WriteMessage(const char *jid, const char *text,
+                             time_t timestamp, guint prefix_flags)
 {
   if (!timestamp) timestamp = time(NULL);
 
@@ -918,6 +918,27 @@
     scr_ShowBuddyWindow();
 }
 
+//  scr_RosterJumpJid(jid)
+// Jump to buddy jid.
+// NOTE: With this function, the buddy is added to the roster if doesn't exist.
+void scr_RosterJumpJid(char *barejid)
+{
+  GSList *roster_elt;
+  // Look for an existing buddy
+  roster_elt = roster_find(barejid, jidsearch,
+                 ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_ROOM);
+  // Create it if necessary
+  if (!roster_elt)
+    roster_elt = roster_add_user(barejid, NULL, NULL, ROSTER_TYPE_USER);
+  // Set a lock to see it in the buddylist
+  buddy_setflags(BUDDATA(roster_elt), ROSTER_FLAG_LOCK, TRUE);
+  buddylist_build();
+  // Jump to the buddy
+  set_current_buddy(buddy_search_jid(barejid));
+  if (chatmode)
+    scr_ShowBuddyWindow();
+}
+
 //  scr_RosterUnreadMessage(next)
 // Go to a new message.  If next is not null, try to go to the next new
 // message.  If it is not possible or if next is NULL, go to the first new