Mercurial > ~mikael > mcabber > hg
diff mcabber/mcabber/xmpp.c @ 2010:a73ce708c2c9
Fix bookmarks losing autojoin attribute
author | Hermitifier |
---|---|
date | Wed, 29 Feb 2012 09:18:09 +0100 |
parents | aa7e03c35488 |
children | 8dc418af3e72 |
line wrap: on
line diff
--- a/mcabber/mcabber/xmpp.c Tue Feb 28 20:26:22 2012 +0100 +++ b/mcabber/mcabber/xmpp.c Wed Feb 29 09:18:09 2012 +0100 @@ -2179,6 +2179,29 @@ return NULL; } +int xmpp_get_bookmark_autojoin(const char *bjid) +{ + LmMessageNode *x; + + if (!bookmarks || !bjid) + return 0; + + // Walk through the storage bookmark tags + for (x = bookmarks->children ; x; x = x->next) { + // If the node is a conference item, check the jid. + if (x->name && !strcmp(x->name, "conference")) { + const char *fjid = lm_message_node_get_attribute(x, "jid"); + if (fjid && !strcasecmp(bjid, fjid)) { + const char *autojoin; + autojoin = lm_message_node_get_attribute(x, "autojoin"); + if (autojoin && (!strcmp(autojoin, "1") || !strcmp(autojoin, "true"))) + return 1; + return 0; + } + } + } + return 0; +} // xmpp_get_all_storage_bookmarks() // Return a GSList with all storage bookmarks. @@ -2279,7 +2302,7 @@ NULL); if (fjoins) lm_message_node_add_child(x, "flag_joins", strflagjoins[fjoins]); - if (group) + if (group && *group) lm_message_node_add_child(x, "group", group); changed = TRUE; scr_LogPrint(LPRINT_LOGNORM, "Updating bookmarks...");