Mercurial > hg
changeset 549:448e299e45da
MUC: "/room topic" shows the current room topic
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 27 Nov 2005 21:38:53 +0100 |
parents | 265c50238a48 |
children | 89cc86940f09 |
files | mcabber/src/commands.c mcabber/src/jabglue.c |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/commands.c Sun Nov 27 21:26:55 2005 +0100 +++ b/mcabber/src/commands.c Sun Nov 27 21:38:53 2005 +0100 @@ -1287,8 +1287,14 @@ } else if (!strncasecmp(arg, "topic", 5)) { gchar *msg; arg += 5; - if (*arg++ != ' ') { - scr_LogPrint(LPRINT_NORMAL, "Wrong or missing parameter"); + for (; *arg && *arg == ' '; arg++) + ; + if (!*arg) { + const char *topic = buddy_gettopic(bud); + if (topic) + scr_LogPrint(LPRINT_NORMAL, "Topic: %s", topic); + else + scr_LogPrint(LPRINT_NORMAL, "No topic has been set"); return; } for (; *arg && *arg == ' '; arg++)
--- a/mcabber/src/jabglue.c Sun Nov 27 21:26:55 2005 +0100 +++ b/mcabber/src/jabglue.c Sun Nov 27 21:38:53 2005 +0100 @@ -1235,6 +1235,7 @@ p = xmlnode_get_tag_data(xmldata, "subject"); if (p != NULL) { if (type && !strcmp(type, TMSG_GROUPCHAT)) { // Room topic + GSList *roombuddy; gchar *mbuf; gchar *subj_noutf8 = from_utf8(p); if (!subj_noutf8) @@ -1245,6 +1246,10 @@ r = strchr(s, '/'); if (r) *r++ = 0; else r = s; + // Set the new topic + roombuddy = roster_find(s, jidsearch, 0); + if (roombuddy) + buddy_settopic(roombuddy->data, subj_noutf8); // Display inside the room window mbuf = g_strdup_printf("%s has set the topic to: %s", r, (subj_noutf8 ? subj_noutf8 : "(?)"));