X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fnumeric.c;h=01091edef17272a9bfaf26f67064c709fdc95486;hb=646a97de5fea240f8e06e1b38aa9e72ea50e0c8c;hp=3fc8c461bf73f1455731bf21f818a63455cd619d;hpb=48326e061aacd954e24f76c53ded10448cbc28eb;p=ngircd-alex.git diff --git a/src/ngircd/numeric.c b/src/ngircd/numeric.c index 3fc8c461..01091ede 100644 --- a/src/ngircd/numeric.c +++ b/src/ngircd/numeric.c @@ -48,12 +48,11 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan) CL2CHAN *cl2chan; CLIENT *cl; char str[LINE_LEN], *ptr; - bool njoin; + bool njoin, xop; - if (Conn_Options(Client_Conn(Client)) & CONN_RFC1459) - njoin = false; - else - njoin = true; + /* Check features of remote server */ + njoin = Conn_Options(Client_Conn(Client)) & CONN_RFC1459 ? false : true; + xop = strchr(Client_Flags(Client), 'X') ? true : false; /* Get all the members of this channel */ cl2chan = Channel_FirstMember(Chan); @@ -67,13 +66,15 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan) * (if user is channel operator or has voice) */ if (str[strlen(str) - 1] != ':') strlcat(str, ",", sizeof(str)); - if (strchr(Channel_UserModes(Chan, cl), 'q')) + + /* Prepare user prefix (ChanOp, voiced, ...) */ + if (xop && strchr(Channel_UserModes(Chan, cl), 'q')) strlcat(str, "~", sizeof(str)); - if (strchr(Channel_UserModes(Chan, cl), 'a')) + if (xop && strchr(Channel_UserModes(Chan, cl), 'a')) strlcat(str, "&", sizeof(str)); if (strchr(Channel_UserModes(Chan, cl), 'o')) strlcat(str, "@", sizeof(str)); - if (strchr(Channel_UserModes(Chan, cl), 'h')) + if (xop && strchr(Channel_UserModes(Chan, cl), 'h')) strlcat(str, "%", sizeof(str)); if (strchr(Channel_UserModes(Chan, cl), 'v')) strlcat(str, "+", sizeof(str)); @@ -149,56 +150,6 @@ Announce_Server(CLIENT * Client, CLIENT * Server) } /* Announce_Server */ -/** - * Announce existing user to a new server - * @param Client New server - * @param User Existing user in the network - */ -static bool -Announce_User(CLIENT * Client, CLIENT * User) -{ - CONN_ID conn; - char *modes; - - conn = Client_Conn(Client); - if (Conn_Options(conn) & CONN_RFC1459) { - /* RFC 1459 mode: separate NICK and USER commands */ - if (! Conn_WriteStr(conn, "NICK %s :%d", - Client_ID(User), Client_Hops(User) + 1)) - return DISCONNECTED; - if (! Conn_WriteStr(conn, ":%s USER %s %s %s :%s", - Client_ID(User), Client_User(User), - Client_Hostname(User), - Client_ID(Client_Introducer(User)), - Client_Info(User))) - return DISCONNECTED; - modes = Client_Modes(User); - if (modes[0]) { - return Conn_WriteStr(conn, ":%s MODE %s +%s", - Client_ID(User), Client_ID(User), - modes); - } - return CONNECTED; - } else { - /* RFC 2813 mode: one combined NICK or SERVICE command */ - if (Client_Type(User) == CLIENT_SERVICE - && strchr(Client_Flags(Client), 'S')) - return IRC_WriteStrClient(Client, - "SERVICE %s %d * +%s %d :%s", Client_Mask(User), - Client_MyToken(Client_Introducer(User)), - Client_Modes(User), Client_Hops(User) + 1, - Client_Info(User)); - else - return IRC_WriteStrClient(Client, - "NICK %s %d %s %s %d +%s :%s", - Client_ID(User), Client_Hops(User) + 1, - Client_User(User), Client_Hostname(User), - Client_MyToken(Client_Introducer(User)), - Client_Modes(User), Client_Info(User)); - } -} /* Announce_User */ - - #ifdef IRCPLUS /** @@ -355,7 +306,7 @@ IRC_Num_ENDOFMOTD(CLIENT * Client, UNUSED REQUEST * Req) while (c) { if (Client_Type(c) == CLIENT_USER || Client_Type(c) == CLIENT_SERVICE) { - if (!Announce_User(Client, c)) + if (!Client_Announce(Client, Client_ThisServer(), c)) return DISCONNECTED; } c = Client_Next(c);