Go to the source code of this file.
Data Structures | |
struct | irc_msg |
Defines | |
#define | IRC_MSG_NSTATIC_ARGS 10 |
Typedefs | |
typedef struct irc_msg | irc_msg_t |
Functions | |
void | irc_msg_parse (char *text, irc_msg_t *msg) |
void | irc_msg_restore (irc_msg_t *msg) |
void | irc_msg_cleanup (irc_msg_t *msg) |
#define IRC_MSG_NSTATIC_ARGS 10 |
void irc_msg_cleanup | ( | irc_msg_t * | msg | ) |
Definition at line 89 of file ircparse.c.
References irc_msg::args, irc_msg::nargs, and irc_msg::static_args.
Referenced by irc_on_read(), and server_parse_input().
00090 { 00091 if (msg->args && msg->args != msg->static_args) free(msg->args); 00092 msg->args = msg->static_args; 00093 msg->nargs = 0; 00094 }
void irc_msg_parse | ( | char * | text, | |
irc_msg_t * | msg | |||
) |
Definition at line 45 of file ircparse.c.
References add_arg(), irc_msg::args, irc_msg::cmd, irc_msg::nargs, NULL, irc_msg::prefix, and irc_msg::static_args.
Referenced by irc_on_read(), queue_entry_from_text(), and server_parse_input().
00046 { 00047 char *space; 00048 00049 memset(msg, 0, sizeof(*msg)); 00050 msg->args = msg->static_args; 00051 if (*text == ':') { 00052 msg->prefix = text+1; 00053 space = strchr(msg->prefix, ' '); 00054 if (!space) return; 00055 *space = 0; 00056 text = space+1; 00057 } 00058 msg->cmd = text; 00059 space = strchr(text, ' '); 00060 if (!space) return; 00061 *space = 0; 00062 text = space+1; 00063 00064 while (*text && (*text != ':')) { 00065 space = strchr(text, ' '); 00066 add_arg(msg, text); 00067 if (space) { 00068 *space = 0; 00069 text = space+1; 00070 } 00071 else break; 00072 } 00073 if (*text == ':') add_arg(msg, text+1); 00074 add_arg(msg, NULL); 00075 msg->nargs--; 00076 }
void irc_msg_restore | ( | irc_msg_t * | msg | ) |
Definition at line 79 of file ircparse.c.
References irc_msg::args, and irc_msg::nargs.
00080 { 00081 int i; 00082 for (i = 0; i < msg->nargs; i++) { 00083 if (msg->args[i][-1] == ':') msg->args[i][-2] = ' '; 00084 else msg->args[i][-1] = ' '; 00085 } 00086 }