--- a/mcabber/src/commands.c Thu Apr 28 14:41:01 2005 +0000
+++ b/mcabber/src/commands.c Thu Apr 28 14:41:16 2005 +0000
@@ -36,6 +36,7 @@
void do_status(char *arg);
void do_add(char *arg);
void do_group(char *arg);
+void do_say(char *arg);
// Global variable for the commands list
static GSList *Commands;
@@ -74,7 +75,7 @@
//cmd_add("request_auth");
cmd_add("roster", "Manipulate the roster/buddylist", COMPL_ROSTER, 0,
&do_roster);
- cmd_add("say", "Say something to the selected buddy", 0, 0, NULL);
+ cmd_add("say", "Say something to the selected buddy", 0, 0, &do_say);
//cmd_add("search");
//cmd_add("send_auth");
cmd_add("status", "Show or set your status", COMPL_STATUS, 0, &do_status);
@@ -167,16 +168,17 @@
char *p;
cmd *curcmd;
- if (*line == 0 || *line != '/') {
- scr_set_chatmode(TRUE);
+ if (!*line) { // User only pressed enter
if (current_buddy) {
+ scr_set_chatmode(TRUE);
buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, TRUE);
+ scr_ShowBuddyWindow();
+ }
+ return 0;
+ }
- if (!*line)
- scr_ShowBuddyWindow();
- else
- send_message(line); // FIXME: are we talking to a _buddy_?
- }
+ if (*line != '/') {
+ do_say(line);
return 0;
}
@@ -315,3 +317,20 @@
update_roster = TRUE;
}
+void do_say(char *arg)
+{
+ gpointer bud = BUDDATA(current_buddy);
+
+ scr_set_chatmode(TRUE);
+ if (current_buddy) {
+ if (!(buddy_gettype(bud) & ROSTER_TYPE_USER)) {
+ scr_LogPrint("This is not a user");
+ return;
+ }
+ buddy_setflags(bud, ROSTER_FLAG_LOCK, TRUE);
+ send_message(arg);
+ } else {
+ scr_LogPrint("Who are you talking to??");
+ }
+}
+