comparison mcabber/src/commands.c @ 475:fa49ac0bb8f3

Add "/room topic", and display topic changes
author Mikael Berthe <mikael@lilotux.net>
date Sun, 02 Oct 2005 23:36:39 +0200
parents 75442262c082
children 882e1acae422
comparison
equal deleted inserted replaced
474:27efa1e2671a 475:fa49ac0bb8f3
154 compl_add_category_word(COMPL_ROOM, "join"); 154 compl_add_category_word(COMPL_ROOM, "join");
155 compl_add_category_word(COMPL_ROOM, "leave"); 155 compl_add_category_word(COMPL_ROOM, "leave");
156 compl_add_category_word(COMPL_ROOM, "names"); 156 compl_add_category_word(COMPL_ROOM, "names");
157 compl_add_category_word(COMPL_ROOM, "nick"); 157 compl_add_category_word(COMPL_ROOM, "nick");
158 compl_add_category_word(COMPL_ROOM, "remove"); 158 compl_add_category_word(COMPL_ROOM, "remove");
159 compl_add_category_word(COMPL_ROOM, "topic");
159 compl_add_category_word(COMPL_ROOM, "unlock"); 160 compl_add_category_word(COMPL_ROOM, "unlock");
160 } 161 }
161 162
162 // expandalias(line) 163 // expandalias(line)
163 // If there is one, expand the alias in line and returns a new allocated line 164 // If there is one, expand the alias in line and returns a new allocated line
251 // local part (UI, logging, etc.) 252 // local part (UI, logging, etc.)
252 hk_message_out(jid, 0, msg); 253 hk_message_out(jid, 0, msg);
253 } 254 }
254 255
255 // Network part 256 // Network part
256 jb_send_msg(jid, msg, buddy_gettype(BUDDATA(current_buddy))); 257 jb_send_msg(jid, msg, buddy_gettype(BUDDATA(current_buddy)), NULL);
257 } 258 }
258 259
259 // process_command(line) 260 // process_command(line)
260 // Process a command line. 261 // Process a command line.
261 // Return 255 if this is the /quit command, and 0 for the other commands. 262 // Return 255 if this is the /quit command, and 0 for the other commands.
1080 if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) { 1081 if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) {
1081 scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom"); 1082 scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom");
1082 return; 1083 return;
1083 } 1084 }
1084 jb_room_unlock(buddy_getjid(bud)); 1085 jb_room_unlock(buddy_getjid(bud));
1086 } else if (!strncasecmp(arg, "topic", 5)) {
1087 gchar *msg;
1088 arg += 5;
1089 if (*arg++ != ' ') {
1090 scr_LogPrint(LPRINT_NORMAL, "Wrong or missing parameter");
1091 return;
1092 }
1093 for (; *arg && *arg == ' '; arg++)
1094 ;
1095 if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) {
1096 scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom");
1097 return;
1098 }
1099 msg = g_strdup_printf("/me has set the topic to: %s", arg);
1100 jb_send_msg(buddy_getjid(bud), msg, ROSTER_TYPE_ROOM, arg);
1101 g_free(msg);
1085 } else { 1102 } else {
1086 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); 1103 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
1087 } 1104 }
1088 } 1105 }
1089 1106