Mercurial > hg
diff 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 |
line wrap: on
line diff
--- a/mcabber/mcabber/xmpp.c Sun Jul 06 13:12:10 2014 +0200 +++ b/mcabber/mcabber/xmpp.c Sun Jul 06 13:24:06 2014 +0200 @@ -2243,6 +2243,27 @@ return NULL; } +// xmpp_get_bookmark_password(roomjid) +// Return the room password if it is present in a bookmark. +const char *xmpp_get_bookmark_password(const char *bjid) +{ + LmMessageNode *x; + + if (!bookmarks || !bjid) + return NULL; + + // 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)) + return lm_message_node_get_child_value(x, "password"); + } + } + return NULL; +} + int xmpp_get_bookmark_autojoin(const char *bjid) { LmMessageNode *x;