projects
/
NextIRCd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
push
[NextIRCd.git]
/
src
/
ircd_parse.c
diff --git
a/src/ircd_parse.c
b/src/ircd_parse.c
index 1bfa8b78fbf482a29f47f372bff1b6491c2ed7f6..950541c10c08749830b7092d0f7626388a6be103 100644
(file)
--- a/
src/ircd_parse.c
+++ b/
src/ircd_parse.c
@@
-21,7
+21,6
@@
#include "tools.h"
#include "IOHandler/IOSockets.h"
#include "ircd_parse.h"
#include "tools.h"
#include "IOHandler/IOSockets.h"
#include "ircd_parse.h"
-struct Server;
#include "struct_client.h"
#include "struct_auth.h"
#include "struct_servermsg.h"
#include "struct_client.h"
#include "struct_auth.h"
#include "struct_servermsg.h"
@@
-35,7
+34,7
@@
static struct ServerMsg parse_static_srvmsg;
#define PARSE_CLIFLAG_OPONLY 0x01
//include all commands
#define PARSE_CLIFLAG_OPONLY 0x01
//include all commands
-#include "cmd
_nick
.h"
+#include "cmd.h"
struct {
struct {
@@
-64,8
+63,8
@@
struct {
} parse_command_list[] = {
{{"PING", "P"}, /* Ping Command */
} parse_command_list[] = {
{{"PING", "P"}, /* Ping Command */
- {
NULL
, 0, 1, 0}, /* Client */
- {
NULL
, 0, 1, 0}, /* Unauthed */
+ {
cmd_ping_cli
, 0, 1, 0}, /* Client */
+ {
cmd_ping_auth
, 0, 1, 0}, /* Unauthed */
{NULL, 0, 1, 0} /* Server */
},
{{"PASS", NULL}, /* PASS Command */
{NULL, 0, 1, 0} /* Server */
},
{{"PASS", NULL}, /* PASS Command */
@@
-79,8
+78,8
@@
struct {
{NULL, 0, 1, 0} /* Server */
},
{{"USER", "U"}, /* User Command */
{NULL, 0, 1, 0} /* Server */
},
{{"USER", "U"}, /* User Command */
- {
NULL, 0, 1
, 0}, /* Client */
- {
NULL, 0
, 1, 0}, /* Unauthed */
+ {
cmd_user_cli, 4, 4
, 0}, /* Client */
+ {
cmd_user_auth, 4
, 1, 0}, /* Unauthed */
{NULL, 0, 1, 0} /* Server */
},
{NULL, 0, 1, 0} /* Server */
},
@@
-91,9
+90,9
@@
static char *parse_irc_token(char **data) {
//find next " "
int i;
char *token = *data;
//find next " "
int i;
char *token = *data;
- for(i = 0;
*data
[i]; i++) {
- if(
*data[i] !
= ' ') {
-
*data
[i] = '\0';
+ for(i = 0;
(*data)
[i]; i++) {
+ if(
(*data)[i] =
= ' ') {
+
(*data)
[i] = '\0';
*data += i+1;
break;
}
*data += i+1;
break;
}
@@
-102,10
+101,9
@@
static char *parse_irc_token(char **data) {
}
static char **parse_irc_params(char *data, int *argc, int maxargs) {
}
static char **parse_irc_params(char *data, int *argc, int maxargs) {
- if(maxargs == 0) {
- *argc = 0;
+ *argc = 0;
+ if(maxargs == 0)
return NULL;
return NULL;
- }
char **argv = calloc(maxargs, sizeof(*argv));
while(*data) {
//skip leading spaces
char **argv = calloc(maxargs, sizeof(*argv));
while(*data) {
//skip leading spaces
@@
-116,7
+114,7
@@
static char **parse_irc_params(char *data, int *argc, int maxargs) {
argv[*argc++] = data + 1;
break;
}
argv[*argc++] = data + 1;
break;
}
- argv[
*argc
++] = data;
+ argv[
(*argc)
++] = data;
if (*argc >= maxargs)
break;
while (*data != ' ' && *data)
if (*argc >= maxargs)
break;
while (*data != ' ' && *data)
@@
-133,7
+131,7
@@
void parse_client_data(struct Client *client, char *data) {
int found = 0;
int i;
for(i = 0; (parse_command_list[i].tokens.client || parse_command_list[i].tokens.server); i++) {
int found = 0;
int i;
for(i = 0; (parse_command_list[i].tokens.client || parse_command_list[i].tokens.server); i++) {
- if(stricmp(parse_command_list[i].tokens.client, token)) {
+ if(stricmp(parse_command_list[i].tokens.client, token)
== 0
) {
found = 1;
break;
}
found = 1;
break;
}
@@
-163,7
+161,7
@@
void parse_unauth_data(struct Auth *auth, char *data) {
int found = 0;
int i;
for(i = 0; (parse_command_list[i].tokens.client || parse_command_list[i].tokens.server); i++) {
int found = 0;
int i;
for(i = 0; (parse_command_list[i].tokens.client || parse_command_list[i].tokens.server); i++) {
- if(stricmp(parse_command_list[i].tokens.client, token)) {
+ if(stricmp(parse_command_list[i].tokens.client, token)
== 0
) {
found = 1;
break;
}
found = 1;
break;
}
@@
-283,7
+281,7
@@
void parse_server_data(struct Server *server, struct IOSocketBuffer *buffer) {
goto parse_server_data_finish;
}
goto parse_server_data_finish;
}
- srvmsg->arglen = srvmsg->msglen - (buf - (unsigned char
*)buffer->buffer);
+ srvmsg->arglen = srvmsg->msglen - (buf - (unsigned char*)buffer->buffer);
srvmsg->args = buf;
int found = 0;
srvmsg->args = buf;
int found = 0;