X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fnumeric.c;h=e1b160b374554b91c80d967f92b89d0f198bc88b;hp=01091edef17272a9bfaf26f67064c709fdc95486;hb=259c314d142abd6f9295047c116235cfdd119563;hpb=8e60fac73b791129b69d20c9e5b02ee1e89f6eaa diff --git a/src/ngircd/numeric.c b/src/ngircd/numeric.c index 01091ede..e1b160b3 100644 --- a/src/ngircd/numeric.c +++ b/src/ngircd/numeric.c @@ -16,7 +16,6 @@ * Handlers for IRC numerics sent to the server */ -#include "imp.h" #include #include #include @@ -35,10 +34,8 @@ #include "messages.h" #include "parse.h" -#include "exp.h" #include "numeric.h" - /** * Announce a channel and its users in the network. */ @@ -47,12 +44,12 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan) { CL2CHAN *cl2chan; CLIENT *cl; - char str[LINE_LEN], *ptr; + char str[COMMAND_LEN], *ptr; bool njoin, xop; /* Check features of remote server */ njoin = Conn_Options(Client_Conn(Client)) & CONN_RFC1459 ? false : true; - xop = strchr(Client_Flags(Client), 'X') ? true : false; + xop = Client_HasFlag(Client, 'X') ? true : false; /* Get all the members of this channel */ cl2chan = Channel_FirstMember(Chan); @@ -68,21 +65,21 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan) strlcat(str, ",", sizeof(str)); /* Prepare user prefix (ChanOp, voiced, ...) */ - if (xop && strchr(Channel_UserModes(Chan, cl), 'q')) + if (xop && Channel_UserHasMode(Chan, cl, 'q')) strlcat(str, "~", sizeof(str)); - if (xop && strchr(Channel_UserModes(Chan, cl), 'a')) + if (xop && Channel_UserHasMode(Chan, cl, 'a')) strlcat(str, "&", sizeof(str)); - if (strchr(Channel_UserModes(Chan, cl), 'o')) + if (Channel_UserHasMode(Chan, cl, 'o')) strlcat(str, "@", sizeof(str)); - if (xop && strchr(Channel_UserModes(Chan, cl), 'h')) + if (xop && Channel_UserHasMode(Chan, cl, 'h')) strlcat(str, "%", sizeof(str)); - if (strchr(Channel_UserModes(Chan, cl), 'v')) + if (Channel_UserHasMode(Chan, cl, 'v')) strlcat(str, "+", sizeof(str)); strlcat(str, Client_ID(cl), sizeof(str)); /* Send the data if the buffer is "full" */ - if (strlen(str) > (LINE_LEN - CLIENT_NICK_LEN - 8)) { + if (strlen(str) > (sizeof(str) - CLIENT_NICK_LEN - 8)) { if (!IRC_WriteStrClient(Client, "%s", str)) return DISCONNECTED; snprintf(str, sizeof(str), "NJOIN %s :", @@ -117,7 +114,6 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan) return CONNECTED; } /* Announce_Channel */ - /** * Announce new server in the network * @param Client New server @@ -149,7 +145,6 @@ Announce_Server(CLIENT * Client, CLIENT * Server) Client_MyToken(Server), Client_Info(Server)); } /* Announce_Server */ - #ifdef IRCPLUS /** @@ -210,7 +205,6 @@ Synchronize_Lists(CLIENT * Client) return CONNECTED; } - /** * Send CHANINFO commands to a new server (inform it about existing channels). * @param Client New server @@ -232,8 +226,8 @@ Send_CHANINFO(CLIENT * Client, CHANNEL * Chan) if (!*modes && !*topic) return CONNECTED; - has_k = strchr(modes, 'k') != NULL; - has_l = strchr(modes, 'l') != NULL; + has_k = Channel_HasMode(Chan, 'k'); + has_l = Channel_HasMode(Chan, 'l'); /* send CHANINFO */ if (!has_k && !has_l) { @@ -255,7 +249,6 @@ Send_CHANINFO(CLIENT * Client, CHANNEL * Chan) #endif /* IRCPLUS */ - /** * Handle ENDOFMOTD (376) numeric and login remote server. * The peer is either an IRC server (no IRC+ protocol), or we got the @@ -321,7 +314,7 @@ IRC_Num_ENDOFMOTD(CLIENT * Client, UNUSED REQUEST * Req) } #ifdef IRCPLUS /* Send CHANINFO if the peer supports it */ - if (strchr(Client_Flags(Client), 'C')) { + if (Client_HasFlag(Client, 'C')) { if (!Send_CHANINFO(Client, chan)) return DISCONNECTED; } @@ -335,7 +328,7 @@ IRC_Num_ENDOFMOTD(CLIENT * Client, UNUSED REQUEST * Req) } #ifdef IRCPLUS - if (strchr(Client_Flags(Client), 'L')) { + if (Client_HasFlag(Client, 'L')) { LogDebug("Synchronizing INVITE- and BAN-lists ..."); if (!Synchronize_Lists(Client)) return DISCONNECTED; @@ -349,7 +342,6 @@ IRC_Num_ENDOFMOTD(CLIENT * Client, UNUSED REQUEST * Req) return CONNECTED; } /* IRC_Num_ENDOFMOTD */ - /** * Handle ISUPPORT (005) numeric. */ @@ -385,5 +377,4 @@ IRC_Num_ISUPPORT(CLIENT * Client, REQUEST * Req) return CONNECTED; } /* IRC_Num_ISUPPORT */ - /* -eof- */