changeset 613:a6b8b373e4de

Try to guess if a roster item is an agent For now we look if the jid contains a '@'...
author Mikael Berthe <mikael@lilotux.net>
date Thu, 15 Dec 2005 23:29:56 +0100
parents 789ec6aed764
children d3020b2c4da2
files mcabber/src/jab_iq.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/jab_iq.c	Thu Dec 15 23:08:22 2005 +0100
+++ b/mcabber/src/jab_iq.c	Thu Dec 15 23:29:56 2005 +0100
@@ -47,6 +47,7 @@
   char *cleanalias;
   enum subscr esub;
   int need_refresh = FALSE;
+  guint roster_type;
 
   for (y = xmlnode_get_tag(x, "item"); y; y = xmlnode_get_nextsibling(y)) {
     gchar *name_noutf8 = NULL;
@@ -100,8 +101,13 @@
                      group);
     }
 
-    roster_add_user(cleanalias, buddyname, group_noutf8, ROSTER_TYPE_USER,
-                    esub);
+    // Tricky... :-\  My guess is that if there is no '@', this is an agent
+    if (strchr(cleanalias, '@'))
+      roster_type = ROSTER_TYPE_USER;
+    else
+      roster_type = ROSTER_TYPE_AGENT;
+
+    roster_add_user(cleanalias, buddyname, group_noutf8, roster_type, esub);
 
     if (name_noutf8)  g_free(name_noutf8);
     if (group_noutf8) g_free(group_noutf8);