Mercurial > hg
comparison mcabber/src/commands.c @ 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 | 7daf906fbcdc |
comparison
equal
deleted
inserted
replaced
1355:9716cf8a0726 | 1356:7794d76ca90e |
---|---|
288 } | 288 } |
289 | 289 |
290 // expandalias(line) | 290 // expandalias(line) |
291 // If there is one, expand the alias in line and returns a new allocated line | 291 // If there is one, expand the alias in line and returns a new allocated line |
292 // If no alias is found, returns line | 292 // If no alias is found, returns line |
293 // Note : if the returned pointer is different from line, the caller should | 293 // Note: if the returned pointer is different from line, the caller should |
294 // g_free() the pointer after use | 294 // g_free() the pointer after use |
295 char *expandalias(const char *line) | 295 char *expandalias(const char *line) |
296 { | 296 { |
297 const char *p1, *p2; | 297 const char *p1, *p2; |
298 char *word; | 298 char *word; |
299 const gchar *value; | 299 const gchar *value; |
1705 | 1705 |
1706 static void do_rename(char *arg) | 1706 static void do_rename(char *arg) |
1707 { | 1707 { |
1708 gpointer bud; | 1708 gpointer bud; |
1709 const char *bjid, *group; | 1709 const char *bjid, *group; |
1710 guint type; | 1710 guint type, on_srv; |
1711 char *newname, *p; | 1711 char *newname, *p; |
1712 char *name_utf8; | 1712 char *name_utf8; |
1713 | 1713 |
1714 if (!current_buddy) | 1714 if (!current_buddy) |
1715 return; | 1715 return; |
1716 bud = BUDDATA(current_buddy); | 1716 bud = BUDDATA(current_buddy); |
1717 | 1717 |
1718 bjid = buddy_getjid(bud); | 1718 bjid = buddy_getjid(bud); |
1719 group = buddy_getgroupname(bud); | 1719 group = buddy_getgroupname(bud); |
1720 type = buddy_gettype(bud); | 1720 type = buddy_gettype(bud); |
1721 on_srv = buddy_getonserverflag(bud); | |
1721 | 1722 |
1722 if (type & ROSTER_TYPE_SPECIAL) { | 1723 if (type & ROSTER_TYPE_SPECIAL) { |
1723 scr_LogPrint(LPRINT_NORMAL, "You can't rename this item."); | 1724 scr_LogPrint(LPRINT_NORMAL, "You can't rename this item."); |
1724 return; | 1725 return; |
1725 } | 1726 } |
1726 | 1727 |
1727 if (!*arg && !(type & ROSTER_TYPE_GROUP)) { | 1728 if (!*arg && !(type & ROSTER_TYPE_GROUP)) { |
1728 scr_LogPrint(LPRINT_NORMAL, "Please specify a new name."); | 1729 scr_LogPrint(LPRINT_NORMAL, "Please specify a new name."); |
1729 return; | 1730 return; |
1731 } | |
1732 | |
1733 if (!(type & ROSTER_TYPE_GROUP) && !on_srv) { | |
1734 scr_LogPrint(LPRINT_NORMAL, | |
1735 "Note: this item will be added to your server roster."); | |
1736 // TODO | |
1737 // If this is a MUC room, we may want to update the bookmark instead... | |
1730 } | 1738 } |
1731 | 1739 |
1732 newname = g_strdup(arg); | 1740 newname = g_strdup(arg); |
1733 // Remove trailing space | 1741 // Remove trailing space |
1734 for (p = newname; *p; p++) ; | 1742 for (p = newname; *p; p++) ; |