40 |
#include "../common/command.h" |
#include "../common/command.h" |
41 |
#include "../common/weeconfig.h" |
#include "../common/weeconfig.h" |
42 |
#include "../gui/gui.h" |
#include "../gui/gui.h" |
43 |
|
#include "../plugins/plugins.h" |
44 |
|
|
45 |
|
|
46 |
/* |
/* |
52 |
*/ |
*/ |
53 |
|
|
54 |
int |
int |
55 |
irc_recv_command (t_irc_server *server, |
irc_recv_command (t_irc_server *server, char *entire_line, |
56 |
char *host, char *command, char *arguments) |
char *host, char *command, char *arguments) |
57 |
{ |
{ |
58 |
int i, cmd_found; |
int i, cmd_found, return_code; |
59 |
|
|
60 |
if (command == NULL) |
if (command == NULL) |
61 |
return -2; |
return -2; |
62 |
|
|
63 |
/* looks for irc command */ |
/* look for IRC command */ |
64 |
cmd_found = -1; |
cmd_found = -1; |
65 |
for (i = 0; irc_commands[i].command_name; i++) |
for (i = 0; irc_commands[i].command_name; i++) |
66 |
|
{ |
67 |
if (strcasecmp (irc_commands[i].command_name, command) == 0) |
if (strcasecmp (irc_commands[i].command_name, command) == 0) |
68 |
{ |
{ |
69 |
cmd_found = i; |
cmd_found = i; |
70 |
break; |
break; |
71 |
} |
} |
72 |
|
} |
73 |
|
|
74 |
/* command not found */ |
/* command not found */ |
75 |
if (cmd_found < 0) |
if (cmd_found < 0) |
76 |
return -3; |
return -3; |
77 |
|
|
78 |
if (irc_commands[i].recv_function != NULL) |
if (irc_commands[i].recv_function != NULL) |
79 |
return (int) (irc_commands[i].recv_function) (server, host, arguments); |
{ |
80 |
|
return_code = (int) (irc_commands[i].recv_function) (server, host, arguments); |
81 |
|
plugins_event_msg (irc_commands[i].command_name, entire_line); |
82 |
|
return return_code; |
83 |
|
} |
84 |
|
|
85 |
return 0; |
return 0; |
86 |
} |
} |