Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/jab_iq.c @ 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 | cf722bff6579 |
children | 44ddf9bec3a5 |
comparison
equal
deleted
inserted
replaced
612:789ec6aed764 | 613:a6b8b373e4de |
---|---|
45 const char *jid, *name, *group, *sub, *ask; | 45 const char *jid, *name, *group, *sub, *ask; |
46 char *buddyname; | 46 char *buddyname; |
47 char *cleanalias; | 47 char *cleanalias; |
48 enum subscr esub; | 48 enum subscr esub; |
49 int need_refresh = FALSE; | 49 int need_refresh = FALSE; |
50 guint roster_type; | |
50 | 51 |
51 for (y = xmlnode_get_tag(x, "item"); y; y = xmlnode_get_nextsibling(y)) { | 52 for (y = xmlnode_get_tag(x, "item"); y; y = xmlnode_get_nextsibling(y)) { |
52 gchar *name_noutf8 = NULL; | 53 gchar *name_noutf8 = NULL; |
53 gchar *group_noutf8 = NULL; | 54 gchar *group_noutf8 = NULL; |
54 | 55 |
98 if (!group_noutf8) | 99 if (!group_noutf8) |
99 scr_LogPrint(LPRINT_LOG, "Decoding of buddy group has failed: %s", | 100 scr_LogPrint(LPRINT_LOG, "Decoding of buddy group has failed: %s", |
100 group); | 101 group); |
101 } | 102 } |
102 | 103 |
103 roster_add_user(cleanalias, buddyname, group_noutf8, ROSTER_TYPE_USER, | 104 // Tricky... :-\ My guess is that if there is no '@', this is an agent |
104 esub); | 105 if (strchr(cleanalias, '@')) |
106 roster_type = ROSTER_TYPE_USER; | |
107 else | |
108 roster_type = ROSTER_TYPE_AGENT; | |
109 | |
110 roster_add_user(cleanalias, buddyname, group_noutf8, roster_type, esub); | |
105 | 111 |
106 if (name_noutf8) g_free(name_noutf8); | 112 if (name_noutf8) g_free(name_noutf8); |
107 if (group_noutf8) g_free(group_noutf8); | 113 if (group_noutf8) g_free(group_noutf8); |
108 g_free(cleanalias); | 114 g_free(cleanalias); |
109 } | 115 } |