X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Firc-info.c;h=e38d5bb6f3338629f35cc2e22b7ef46bb08f6e15;hp=ba7a2b74243cd4cc21bfc8917510502104387d5a;hb=HEAD;hpb=a4af9024fd12d4a755ddf2a7aa1d0036ff997672 diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c index ba7a2b74..7287f3ca 100644 --- a/src/ngircd/irc-info.c +++ b/src/ngircd/irc-info.c @@ -138,7 +138,7 @@ who_flags_qualifier(CLIENT *Client, const char *chan_user_modes, static bool IRC_WHO_Channel(CLIENT *Client, CHANNEL *Chan, bool OnlyOps) { - bool is_visible, is_member, is_ircop; + bool is_visible, is_member, is_ircop, is_oper; CL2CHAN *cl2chan; char flags[10]; CLIENT *c; @@ -148,9 +148,10 @@ IRC_WHO_Channel(CLIENT *Client, CHANNEL *Chan, bool OnlyOps) assert( Chan != NULL ); is_member = Channel_IsMemberOf(Chan, Client); + is_oper = Client_HasMode(Client, 'o'); /* Secret channel? */ - if (!is_member && Channel_HasMode(Chan, 's')) + if (!is_member && !is_oper && Channel_HasMode(Chan, 's')) return IRC_WriteStrClient(Client, RPL_ENDOFWHO_MSG, Client_ID(Client), Channel_Name(Chan)); @@ -163,7 +164,7 @@ IRC_WHO_Channel(CLIENT *Client, CHANNEL *Chan, bool OnlyOps) continue; is_visible = !Client_HasMode(c, 'i'); - if (is_member || is_visible) { + if (is_member || is_visible || is_oper) { memset(flags, 0, sizeof(flags)); if (Client_HasMode(c, 'a')) @@ -407,7 +408,7 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c) /* Local client and requester is the user itself or an IRC Op? */ if (Client_Conn(c) > NONE && - (from == c || (!Conf_MorePrivacy && Client_HasMode(from, 'o')))) { + (from == c || Client_HasMode(from, 'o'))) { /* Client hostname */ if (!IRC_WriteStrClient(from, RPL_WHOISHOST_MSG, Client_ID(from), Client_ID(c), @@ -558,7 +559,15 @@ IRC_INFO(CLIENT * Client, REQUEST * Req) NGIRCd_Version)) return DISCONNECTED; -#if defined(__DATE__) && defined(__TIME__) +#if defined(BIRTHDATE) + char t_str[60]; + time_t t = BIRTHDATE; + (void)strftime(t_str, sizeof(t_str), "%a %b %d %Y at %H:%M:%S (%Z)", + localtime(&t)); + snprintf(msg, sizeof(msg), "Birth Date: %s", t_str); + if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg)) + return DISCONNECTED; +#elif defined(__DATE__) && defined(__TIME__) snprintf(msg, sizeof(msg), "Birth Date: %s at %s", __DATE__, __TIME__); if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg)) return DISCONNECTED; @@ -809,7 +818,7 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req ) /* Now print all clients which are not in any channel */ c = Client_First(); - snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG, Client_ID(from), "*", "*"); + snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG, Client_ID(from), '*', "*"); while (c) { if (Client_Type(c) == CLIENT_USER && Channel_FirstChannelOf(c) == NULL @@ -821,11 +830,11 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req ) strlcat(rpl, Client_ID(c), sizeof(rpl)); if (strlen(rpl) > COMMAND_LEN - CLIENT_NICK_LEN - 4) { - /* Line is gwoing too long, send now */ + /* Line is going too long, send now */ if (!IRC_WriteStrClient(from, "%s", rpl)) return DISCONNECTED; snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG, - Client_ID(from), "*", "*"); + Client_ID(from), '*', "*"); } } c = Client_Next(c); @@ -886,22 +895,22 @@ IRC_STATS( CLIENT *Client, REQUEST *Req ) list = Class_GetList(CLASS_GLINE); else list = Class_GetList(CLASS_KLINE); - list_item = Lists_GetFirst(list); - while (list_item) { - if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG, + list_item = Lists_GetFirst(list); + while (list_item) { + if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG, Client_ID(from), query, Lists_GetMask(list_item), Lists_GetValidity(list_item), Lists_GetReason(list_item))) - return DISCONNECTED; - list_item = Lists_GetNext(list_item); - } + return DISCONNECTED; + list_item = Lists_GetNext(list_item); + } break; case 'L': /* Link status (servers and user links) */ if (!Op_Check(from, Req)) return Op_NoPrivileges(from, Req); more_links = true; - + /* fall through */ case 'l': /* Link status (servers and own link) */ time_now = time(NULL); for (con = Conn_First(); con != NONE; con = Conn_Next(con)) { @@ -1256,6 +1265,8 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req ) if (Client_Type(c) != CLIENT_USER) continue; + if (Client_HasMode(c, 'i')) + continue; if (!MatchCaseInsensitive(query, Client_ID(c))) continue; if (!IRC_WHOIS_SendReply(Client, from, c)) @@ -1364,7 +1375,7 @@ IRC_WHOWAS( CLIENT *Client, REQUEST *Req ) /** * Send LUSERS reply to a client. * - * @param Client The receipient of the information. + * @param Client The recipient of the information. * @return CONNECTED or DISCONNECTED. */ GLOBAL bool @@ -1489,6 +1500,8 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan) char str[COMMAND_LEN]; CL2CHAN *cl2chan; CLIENT *cl; + bool secret_channel; + char chan_symbol; assert(Client != NULL); assert(Chan != NULL); @@ -1503,10 +1516,13 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan) return CONNECTED; /* Secret channel? */ - if (!is_member && Channel_HasMode(Chan, 's')) + secret_channel = Channel_HasMode(Chan, 's'); + if (!is_member && secret_channel) return CONNECTED; - snprintf(str, sizeof(str), RPL_NAMREPLY_MSG, Client_ID(Client), "=", + chan_symbol = secret_channel ? '@' : '='; + + snprintf(str, sizeof(str), RPL_NAMREPLY_MSG, Client_ID(Client), chan_symbol, Channel_Name(Chan)); cl2chan = Channel_FirstMember(Chan); while (cl2chan) { @@ -1529,7 +1545,7 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan) if (!IRC_WriteStrClient(Client, "%s", str)) return DISCONNECTED; snprintf(str, sizeof(str), RPL_NAMREPLY_MSG, - Client_ID(Client), "=", + Client_ID(Client), chan_symbol, Channel_Name(Chan)); } }