Only update server private storage data if they've changed
We do not want to call send_storage_bookmarks() and send_storage_rosternotes()
when the data haven't been updated.
--- a/mcabber/src/jabglue.c Wed Nov 15 00:04:57 2006 +0100
+++ b/mcabber/src/jabglue.c Wed Nov 15 19:23:40 2006 +0100
@@ -1182,6 +1182,7 @@
const char *nick, const char *passwd, int autojoin)
{
xmlnode x;
+ bool changed = FALSE;
if (!roomid)
return;
@@ -1208,6 +1209,7 @@
// We've found a bookmark for this room. Let's hide it and we'll
// create a new one.
xmlnode_hide(x);
+ changed = TRUE;
break;
}
}
@@ -1223,8 +1225,12 @@
xmlnode_insert_cdata(xmlnode_insert_tag(x, "nick"), nick, -1);
if (passwd)
xmlnode_insert_cdata(xmlnode_insert_tag(x, "password"), passwd, -1);
+ changed = TRUE;
}
+ if (!changed)
+ return;
+
if (online)
send_storage_bookmarks();
else
@@ -1275,6 +1281,7 @@
void jb_set_storage_rosternotes(const char *barejid, const char *note)
{
xmlnode x;
+ bool changed = FALSE;
if (!barejid)
return;
@@ -1301,6 +1308,7 @@
// We've found a note for this jid. Let's hide it and we'll
// create a new one.
xmlnode_hide(x);
+ changed = TRUE;
break;
}
}
@@ -1311,8 +1319,12 @@
x = xmlnode_insert_tag(rosternotes, "note");
xmlnode_put_attrib(x, "jid", barejid);
xmlnode_insert_cdata(x, note, -1);
+ changed = TRUE;
}
+ if (!changed)
+ return;
+
if (online)
send_storage_rosternotes();
else