--- a/mcabber/src/jabglue.c Sun Dec 09 19:26:37 2007 +0100
+++ b/mcabber/src/jabglue.c Mon Dec 10 21:45:24 2007 +0100
@@ -1352,7 +1352,7 @@
jb_reset_keepalive();
}
-// jb_is_bookmarked()
+// jb_is_bookmarked(roomjid)
// Return TRUE if there's a bookmark for the given jid.
guint jb_is_bookmarked(const char *bjid)
{
@@ -1377,6 +1377,32 @@
return FALSE;
}
+// jb_get_bookmark_nick(roomjid)
+// Return the room nickname if it is present in a bookmark.
+const char *jb_get_bookmark_nick(const char *bjid)
+{
+ xmlnode x;
+
+ if (!bookmarks || !bjid)
+ return NULL;
+
+ // Walk through the storage bookmark tags
+ x = xmlnode_get_firstchild(bookmarks);
+ for ( ; x; x = xmlnode_get_nextsibling(x)) {
+ const char *fjid;
+ const char *p;
+ p = xmlnode_get_name(x);
+ // If the node is a conference item, check the jid.
+ if (p && !strcmp(p, "conference")) {
+ fjid = xmlnode_get_attrib(x, "jid");
+ if (fjid && !strcasecmp(bjid, fjid))
+ return xmlnode_get_tag_data(x, "nick");
+ }
+ }
+ return NULL;
+}
+
+
// jb_get_all_storage_bookmarks()
// Return a GSList with all storage bookmarks.
// The caller should g_free the list (not the MUC jids).
@@ -2790,7 +2816,7 @@
// evcontext: 0, 1 == reject, accept
if (evcontext & ~EVS_CONTEXT_USER) {
- char *nickname = default_muc_nickname();
+ char *nickname = default_muc_nickname(invitation->to);
jb_room_join(invitation->to, nickname, invitation->passwd);
g_free(nickname);
} else {