comparison mcabber/src/jabglue.c @ 1525:68580b6be895

Display more information in /room bookmark (autojoin, nick...) With this patch /room bookmark adds a '*' prefix when autojoin is set in the bookmark list. It also displays the nick and the room name contained in the bookmarks.
author Mikael Berthe <mikael@lilotux.net>
date Thu, 02 Oct 2008 20:00:11 +0200
parents 35020a2ed115
children 4b4b3948420c
comparison
equal deleted inserted replaced
1524:935289bf02ea 1525:68580b6be895
1426 } 1426 }
1427 1427
1428 1428
1429 // jb_get_all_storage_bookmarks() 1429 // jb_get_all_storage_bookmarks()
1430 // Return a GSList with all storage bookmarks. 1430 // Return a GSList with all storage bookmarks.
1431 // The caller should g_free the list (not the MUC jids). 1431 // The caller should g_free the list and its contents.
1432 GSList *jb_get_all_storage_bookmarks(void) 1432 GSList *jb_get_all_storage_bookmarks(void)
1433 { 1433 {
1434 xmlnode x; 1434 xmlnode x;
1435 GSList *sl_bookmarks = NULL; 1435 GSList *sl_bookmarks = NULL;
1436 1436
1442 x = xmlnode_get_firstchild(bookmarks); 1442 x = xmlnode_get_firstchild(bookmarks);
1443 for ( ; x; x = xmlnode_get_nextsibling(x)) { 1443 for ( ; x; x = xmlnode_get_nextsibling(x)) {
1444 const char *p = xmlnode_get_name(x); 1444 const char *p = xmlnode_get_name(x);
1445 // If the node is a conference item, let's add the note to our list. 1445 // If the node is a conference item, let's add the note to our list.
1446 if (p && !strcmp(p, "conference")) { 1446 if (p && !strcmp(p, "conference")) {
1447 struct bookmark *bm_elt;
1448 const char *autojoin, *name, *nick;
1447 const char *fjid = xmlnode_get_attrib(x, "jid"); 1449 const char *fjid = xmlnode_get_attrib(x, "jid");
1448 if (!fjid) 1450 if (!fjid)
1449 continue; 1451 continue;
1450 sl_bookmarks = g_slist_append(sl_bookmarks, (char*)fjid); 1452 bm_elt = g_new0(struct bookmark, 1);
1453 bm_elt->roomjid = g_strdup(fjid);
1454 autojoin = xmlnode_get_attrib(x, "autojoin");
1455 nick = xmlnode_get_attrib(x, "nick");
1456 name = xmlnode_get_attrib(x, "name");
1457 if (autojoin && !strcmp(autojoin, "1"))
1458 bm_elt->autojoin = 1;
1459 if (nick)
1460 bm_elt->nick = g_strdup(nick);
1461 if (name)
1462 bm_elt->name = g_strdup(name);
1463 sl_bookmarks = g_slist_append(sl_bookmarks, bm_elt);
1451 } 1464 }
1452 } 1465 }
1453 return sl_bookmarks; 1466 return sl_bookmarks;
1454 } 1467 }
1455 1468