Mercurial > hg
changeset 1363:32077249de77
Warn if a MUC room without bookmark is renamed
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 11 Nov 2007 18:49:43 +0100 |
parents | 9ee58f91d19e |
children | ff1f6facdc0c |
files | mcabber/src/commands.c mcabber/src/jabglue.c mcabber/src/jabglue.h |
diffstat | 3 files changed, 32 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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).
--- 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,