comparison mcabber/mcabber/xmpp.c @ 2138:f063e36425a2

Use bookmarked password (if any) when using "/room join" (The password was only used when auto-joining.)
author Mikael Berthe <mikael@lilotux.net>
date Sun, 06 Jul 2014 13:24:06 +0200
parents 0bfc4bfc127c
children e702073612de
comparison
equal deleted inserted replaced
2137:0bfc4bfc127c 2138:f063e36425a2
2241 } 2241 }
2242 } 2242 }
2243 return NULL; 2243 return NULL;
2244 } 2244 }
2245 2245
2246 // xmpp_get_bookmark_password(roomjid)
2247 // Return the room password if it is present in a bookmark.
2248 const char *xmpp_get_bookmark_password(const char *bjid)
2249 {
2250 LmMessageNode *x;
2251
2252 if (!bookmarks || !bjid)
2253 return NULL;
2254
2255 // Walk through the storage bookmark tags
2256 for (x = bookmarks->children ; x; x = x->next) {
2257 // If the node is a conference item, check the jid.
2258 if (x->name && !strcmp(x->name, "conference")) {
2259 const char *fjid = lm_message_node_get_attribute(x, "jid");
2260 if (fjid && !strcasecmp(bjid, fjid))
2261 return lm_message_node_get_child_value(x, "password");
2262 }
2263 }
2264 return NULL;
2265 }
2266
2246 int xmpp_get_bookmark_autojoin(const char *bjid) 2267 int xmpp_get_bookmark_autojoin(const char *bjid)
2247 { 2268 {
2248 LmMessageNode *x; 2269 LmMessageNode *x;
2249 2270
2250 if (!bookmarks || !bjid) 2271 if (!bookmarks || !bjid)