comparison mcabber/src/jab_iq.c @ 1348:26d1dd2c948f

Add option 'roster_hide_domain' Add an option to only display usernames (not the full JIDs) in the roster window when no name has been specified.
author Mikael Berthe <mikael@lilotux.net>
date Fri, 09 Nov 2007 23:33:52 +0100
parents 2031f4b2cced
children 7caedca15e50
comparison
equal deleted inserted replaced
1347:07816313073b 1348:26d1dd2c948f
261 enum subscr esub; 261 enum subscr esub;
262 int need_refresh = FALSE; 262 int need_refresh = FALSE;
263 guint roster_type; 263 guint roster_type;
264 264
265 for (y = xmlnode_get_tag(x, "item"); y; y = xmlnode_get_nextsibling(y)) { 265 for (y = xmlnode_get_tag(x, "item"); y; y = xmlnode_get_nextsibling(y)) {
266 char *name_tmp = NULL;
266 267
267 fjid = xmlnode_get_attrib(y, "jid"); 268 fjid = xmlnode_get_attrib(y, "jid");
268 name = xmlnode_get_attrib(y, "name"); 269 name = xmlnode_get_attrib(y, "name");
269 sub = xmlnode_get_attrib(y, "subscription"); 270 sub = xmlnode_get_attrib(y, "subscription");
270 ask = xmlnode_get_attrib(y, "ask"); 271 ask = xmlnode_get_attrib(y, "ask");
294 } 295 }
295 296
296 if (ask && !strcmp(ask, "subscribe")) 297 if (ask && !strcmp(ask, "subscribe"))
297 esub |= sub_pending; 298 esub |= sub_pending;
298 299
299 if (!name) 300 if (!name) {
300 name = cleanalias; 301 if (!settings_opt_get_int("roster_hide_domain")) {
302 name = cleanalias;
303 } else {
304 char *p;
305 name = name_tmp = g_strdup(cleanalias);
306 p = strchr(name_tmp, JID_DOMAIN_SEPARATOR);
307 if (p) *p = '\0';
308 }
309 }
301 310
302 // Tricky... :-\ My guess is that if there is no JID_DOMAIN_SEPARATOR, 311 // Tricky... :-\ My guess is that if there is no JID_DOMAIN_SEPARATOR,
303 // this is an agent. 312 // this is an agent.
304 if (strchr(cleanalias, JID_DOMAIN_SEPARATOR)) 313 if (strchr(cleanalias, JID_DOMAIN_SEPARATOR))
305 roster_type = ROSTER_TYPE_USER; 314 roster_type = ROSTER_TYPE_USER;
306 else 315 else
307 roster_type = ROSTER_TYPE_AGENT; 316 roster_type = ROSTER_TYPE_AGENT;
308 317
309 roster_add_user(cleanalias, name, group, roster_type, esub); 318 roster_add_user(cleanalias, name, group, roster_type, esub);
310 319
320 g_free(name_tmp);
311 g_free(cleanalias); 321 g_free(cleanalias);
312 } 322 }
313 323
314 buddylist_build(); 324 buddylist_build();
315 update_roster = TRUE; 325 update_roster = TRUE;