changeset 1356:7794d76ca90e

Warn if the user renames a local item (If a local item is renamed, it is implicitly created on the server.)
author Mikael Berthe <mikael@lilotux.net>
date Sat, 10 Nov 2007 23:23:44 +0100
parents 9716cf8a0726
children 7bbfb0073f88
files mcabber/src/commands.c
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/commands.c	Sat Nov 10 23:15:16 2007 +0100
+++ b/mcabber/src/commands.c	Sat Nov 10 23:23:44 2007 +0100
@@ -290,8 +290,8 @@
 //  expandalias(line)
 // If there is one, expand the alias in line and returns a new allocated line
 // If no alias is found, returns line
-// Note : if the returned pointer is different from line, the caller should
-//        g_free() the pointer after use
+// Note: if the returned pointer is different from line, the caller should
+//       g_free() the pointer after use
 char *expandalias(const char *line)
 {
   const char *p1, *p2;
@@ -1707,7 +1707,7 @@
 {
   gpointer bud;
   const char *bjid, *group;
-  guint type;
+  guint type, on_srv;
   char *newname, *p;
   char *name_utf8;
 
@@ -1715,9 +1715,10 @@
     return;
   bud = BUDDATA(current_buddy);
 
-  bjid  = buddy_getjid(bud);
-  group = buddy_getgroupname(bud);
-  type  = buddy_gettype(bud);
+  bjid   = buddy_getjid(bud);
+  group  = buddy_getgroupname(bud);
+  type   = buddy_gettype(bud);
+  on_srv = buddy_getonserverflag(bud);
 
   if (type & ROSTER_TYPE_SPECIAL) {
     scr_LogPrint(LPRINT_NORMAL, "You can't rename this item.");
@@ -1729,6 +1730,13 @@
     return;
   }
 
+  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...
+  }
+
   newname = g_strdup(arg);
   // Remove trailing space
   for (p = newname; *p; p++) ;