comparison 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
comparison
equal deleted inserted replaced
2009:a859ed648638 2010:a73ce708c2c9
2177 } 2177 }
2178 } 2178 }
2179 return NULL; 2179 return NULL;
2180 } 2180 }
2181 2181
2182 int xmpp_get_bookmark_autojoin(const char *bjid)
2183 {
2184 LmMessageNode *x;
2185
2186 if (!bookmarks || !bjid)
2187 return 0;
2188
2189 // Walk through the storage bookmark tags
2190 for (x = bookmarks->children ; x; x = x->next) {
2191 // If the node is a conference item, check the jid.
2192 if (x->name && !strcmp(x->name, "conference")) {
2193 const char *fjid = lm_message_node_get_attribute(x, "jid");
2194 if (fjid && !strcasecmp(bjid, fjid)) {
2195 const char *autojoin;
2196 autojoin = lm_message_node_get_attribute(x, "autojoin");
2197 if (autojoin && (!strcmp(autojoin, "1") || !strcmp(autojoin, "true")))
2198 return 1;
2199 return 0;
2200 }
2201 }
2202 }
2203 return 0;
2204 }
2182 2205
2183 // xmpp_get_all_storage_bookmarks() 2206 // xmpp_get_all_storage_bookmarks()
2184 // Return a GSList with all storage bookmarks. 2207 // Return a GSList with all storage bookmarks.
2185 // The caller should g_free the list (not the MUC jids). 2208 // The caller should g_free the list (not the MUC jids).
2186 GSList *xmpp_get_all_storage_bookmarks(void) 2209 GSList *xmpp_get_all_storage_bookmarks(void)
2277 lm_message_node_set_attributes(x, "autowhois", 2300 lm_message_node_set_attributes(x, "autowhois",
2278 (awhois == autowhois_on) ? "1" : "0", 2301 (awhois == autowhois_on) ? "1" : "0",
2279 NULL); 2302 NULL);
2280 if (fjoins) 2303 if (fjoins)
2281 lm_message_node_add_child(x, "flag_joins", strflagjoins[fjoins]); 2304 lm_message_node_add_child(x, "flag_joins", strflagjoins[fjoins]);
2282 if (group) 2305 if (group && *group)
2283 lm_message_node_add_child(x, "group", group); 2306 lm_message_node_add_child(x, "group", group);
2284 changed = TRUE; 2307 changed = TRUE;
2285 scr_LogPrint(LPRINT_LOGNORM, "Updating bookmarks..."); 2308 scr_LogPrint(LPRINT_LOGNORM, "Updating bookmarks...");
2286 } 2309 }
2287 2310