X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/8ac75529832a07c76478f08552034f8f3380309b..9cb932632f02f6ae516bd3f12aab98ff861c3b70:/src/parse.c diff --git a/src/parse.c b/src/parse.c index 78353ac..40dbc54 100644 --- a/src/parse.c +++ b/src/parse.c @@ -31,16 +31,14 @@ #include "channel.h" #include "common.h" #include "hash.h" -#include "irc_string.h" -#include "sprintf_irc.h" +#include "match.h" #include "ircd.h" #include "numeric.h" -#include "s_log.h" +#include "logger.h" #include "s_stats.h" #include "send.h" #include "msg.h" #include "s_conf.h" -#include "memory.h" #include "s_serv.h" #include "packet.h" @@ -63,8 +61,6 @@ static void do_alias(struct alias_entry *, struct Client *, char *); static int handle_command(struct Message *, struct Client *, struct Client *, int, const char**); -static int cmd_hash(const char *p); - static char buffer[1024]; /* turn a string into a parc/parv pair */ @@ -135,7 +131,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) struct Message *mptr; s_assert(MyConnect(client_p)); - s_assert(client_p->localClient->fd >= 0); + s_assert(client_p->localClient->F->fd >= 0); if(IsAnyDead(client_p)) return; @@ -165,7 +161,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) /* didnt find any matching client, issue a kill */ if(from == NULL) { - ServerStats->is_unpf++; + ServerStats.is_unpf++; remove_unknown(client_p, sender, pbuffer); return; } @@ -175,7 +171,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) /* fake direction, hmm. */ if(from->from != client_p) { - ServerStats->is_wrdi++; + ServerStats.is_wrdi++; cancel_clients(client_p, from, pbuffer); return; } @@ -186,7 +182,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) if(*ch == '\0') { - ServerStats->is_empt++; + ServerStats.is_empt++; return; } @@ -207,7 +203,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) { mptr = NULL; numeric = ch; - ServerStats->is_num++; + ServerStats.is_num++; s = ch + 3; /* I know this is ' ' from above if */ *s++ = '\0'; /* blow away the ' ', and point s to next part */ } @@ -218,7 +214,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) if((s = strchr(ch, ' '))) *s++ = '\0'; - mptr = irc_dictionary_retrieve(cmd_dict, mptr); + mptr = irc_dictionary_retrieve(cmd_dict, ch); /* no command or its encap only, error */ if(!mptr || !mptr->cmd) @@ -251,7 +247,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) me.name, from->name, ch); } } - ServerStats->is_unco++; + ServerStats.is_unco++; return; } @@ -475,7 +471,7 @@ report_messages(struct Client *source_p) struct Message *msg; struct alias_entry *amsg; - IRC_DICTIONARY_FOREACH(msg, &iter, cmd_dict) + DICTIONARY_FOREACH(msg, &iter, cmd_dict) { s_assert(msg->cmd != NULL); sendto_one_numeric(source_p, RPL_STATSCOMMANDS, @@ -484,7 +480,7 @@ report_messages(struct Client *source_p) msg->bytes, msg->rcount); } - IRC_DICTIONARY_FOREACH(amsg, &iter, alias_dict) + DICTIONARY_FOREACH(amsg, &iter, alias_dict) { s_assert(amsg->name != NULL); sendto_one_numeric(source_p, RPL_STATSCOMMANDS, @@ -512,7 +508,7 @@ cancel_clients(struct Client *client_p, struct Client *source_p, char *cmd) sendto_realops_snomask(SNO_DEBUG, L_ALL, "Message for %s[%s] from %s", source_p->name, source_p->from->name, - get_server_name(client_p, SHOW_IP)); + client_p->name); } else { @@ -522,7 +518,7 @@ cancel_clients(struct Client *client_p, struct Client *source_p, char *cmd) source_p->username, source_p->host, source_p->from->name, - get_server_name(client_p, SHOW_IP)); + client_p->name); } } @@ -547,7 +543,7 @@ remove_unknown(struct Client *client_p, char *lsender, char *lbuffer) { sendto_realops_snomask(SNO_DEBUG, L_ALL, "Unknown prefix (%s) from %s, Squitting %s", - lbuffer, get_server_name(client_p, SHOW_IP), lsender); + lbuffer, client_p->name, lsender); sendto_one(client_p, ":%s SQUIT %s :(Unknown prefix (%s) from %s)", @@ -602,10 +598,10 @@ do_numeric(char numeric[], struct Client *client_p, struct Client *source_p, int int tl; /* current length of presently being built string in t */ for (i = 2; i < (parc - 1); i++) { - tl = ircsprintf(t, " %s", parv[i]); + tl = rb_sprintf(t, " %s", parv[i]); t += tl; } - ircsprintf(t, " :%s", parv[parc - 1]); + rb_sprintf(t, " :%s", parv[parc - 1]); } if((target_p = find_client(parv[1])) != NULL) @@ -660,9 +656,9 @@ do_numeric(char numeric[], struct Client *client_p, struct Client *source_p, int return; } else if((chptr = find_channel(parv[1])) != NULL) - sendto_channel_local(ALL_MEMBERS, chptr, - ":%s %s %s %s", - source_p->name, numeric, chptr->chname, buffer); + sendto_channel_flags(client_p, ALL_MEMBERS, source_p, chptr, + "%s %s%s", + numeric, chptr->chname, buffer); } static void do_alias(struct alias_entry *aptr, struct Client *source_p, char *text)