# HG changeset patch # User Mikael Berthe # Date 1194803383 -3600 # Node ID 32077249de773aec21e632a5e2050ab36ff265c5 # Parent 9ee58f91d19ef9baa3d7ce9422bdc20e97509c7e Warn if a MUC room without bookmark is renamed diff -r 9ee58f91d19e -r 32077249de77 mcabber/src/commands.c --- a/mcabber/src/commands.c Sun Nov 11 16:07:32 2007 +0100 +++ b/mcabber/src/commands.c Sun Nov 11 18:49:43 2007 +0100 @@ -1750,8 +1750,12 @@ if (!(type & ROSTER_TYPE_GROUP) && !on_srv) { scr_LogPrint(LPRINT_NORMAL, "Note: this item will be added to your server roster."); - // TODO - // If this is a MUC room, we may want to update the bookmark instead... + // If this is a MUC room w/o bookmark, let's give a small hint... + if (!jb_is_bookmarked(bjid)) { + scr_LogPrint(LPRINT_NORMAL, + "You should add a room bookmark or it will not be " + "recognized as a MUC room next time you run mcabber."); + } } newname = g_strdup(arg); diff -r 9ee58f91d19e -r 32077249de77 mcabber/src/jabglue.c --- a/mcabber/src/jabglue.c Sun Nov 11 16:07:32 2007 +0100 +++ b/mcabber/src/jabglue.c Sun Nov 11 18:49:43 2007 +0100 @@ -1353,6 +1353,31 @@ jb_reset_keepalive(); } +// jb_is_bookmarked() +// Return TRUE if there's a bookmark for the given jid. +guint jb_is_bookmarked(const char *bjid) +{ + xmlnode x; + + if (!bookmarks) + return FALSE; + + // 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 TRUE; + } + } + return FALSE; +} + // jb_get_all_storage_bookmarks() // Return a GSList with all storage bookmarks. // The caller should g_free the list (not the MUC jids). diff -r 9ee58f91d19e -r 32077249de77 mcabber/src/jabglue.h --- a/mcabber/src/jabglue.h Sun Nov 11 16:07:32 2007 +0100 +++ b/mcabber/src/jabglue.h Sun Nov 11 18:49:43 2007 +0100 @@ -77,6 +77,7 @@ struct role_affil ra, const char *reason); void jb_iqs_display_list(void); void jb_request(const char *fjid, enum iqreq_type reqtype); +guint jb_is_bookmarked(const char *bjid); GSList *jb_get_all_storage_bookmarks(void); void jb_set_storage_bookmark(const char *roomid, const char *name, const char *nick, const char *passwd,