# HG changeset patch # User Mikael Berthe # Date 1133123933 -3600 # Node ID 448e299e45da032fce90e69db9d35f8c8549e242 # Parent 265c50238a48666a7c7875f3841d558447e01c37 MUC: "/room topic" shows the current room topic diff -r 265c50238a48 -r 448e299e45da mcabber/src/commands.c --- 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++) diff -r 265c50238a48 -r 448e299e45da mcabber/src/jabglue.c --- 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 : "(?)"));