comparison mcabber/src/jabglue.c @ 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 1df26ff0ed8c
children 64cb4de94972
comparison
equal deleted inserted replaced
548:265c50238a48 549:448e299e45da
1233 body = xmlnode_get_tag_data(xmldata, "body"); 1233 body = xmlnode_get_tag_data(xmldata, "body");
1234 1234
1235 p = xmlnode_get_tag_data(xmldata, "subject"); 1235 p = xmlnode_get_tag_data(xmldata, "subject");
1236 if (p != NULL) { 1236 if (p != NULL) {
1237 if (type && !strcmp(type, TMSG_GROUPCHAT)) { // Room topic 1237 if (type && !strcmp(type, TMSG_GROUPCHAT)) { // Room topic
1238 GSList *roombuddy;
1238 gchar *mbuf; 1239 gchar *mbuf;
1239 gchar *subj_noutf8 = from_utf8(p); 1240 gchar *subj_noutf8 = from_utf8(p);
1240 if (!subj_noutf8) 1241 if (!subj_noutf8)
1241 scr_LogPrint(LPRINT_LOG, 1242 scr_LogPrint(LPRINT_LOG,
1242 "Decoding of room topic has failed: %s", p); 1243 "Decoding of room topic has failed: %s", p);
1243 // Get the room (s) and the nickname (r) 1244 // Get the room (s) and the nickname (r)
1244 s = g_strdup(from); 1245 s = g_strdup(from);
1245 r = strchr(s, '/'); 1246 r = strchr(s, '/');
1246 if (r) *r++ = 0; 1247 if (r) *r++ = 0;
1247 else r = s; 1248 else r = s;
1249 // Set the new topic
1250 roombuddy = roster_find(s, jidsearch, 0);
1251 if (roombuddy)
1252 buddy_settopic(roombuddy->data, subj_noutf8);
1248 // Display inside the room window 1253 // Display inside the room window
1249 mbuf = g_strdup_printf("%s has set the topic to: %s", r, 1254 mbuf = g_strdup_printf("%s has set the topic to: %s", r,
1250 (subj_noutf8 ? subj_noutf8 : "(?)")); 1255 (subj_noutf8 ? subj_noutf8 : "(?)"));
1251 scr_WriteIncomingMessage(s, mbuf, 0, 1256 scr_WriteIncomingMessage(s, mbuf, 0,
1252 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG); 1257 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG);