#include "conn-func.h"
#include "conn-zip.h"
#include "channel.h"
+#include "class.h"
#include "conf.h"
#include "defines.h"
+#include "lists.h"
#include "log.h"
#include "messages.h"
#include "match.h"
COMMAND *cmd;
time_t time_now;
unsigned int days, hrs, mins;
+ struct list_head *list;
+ struct list_elem *list_item;
assert(Client != NULL);
assert(Req != NULL);
query = '*';
switch (query) {
+ case 'g': /* Network-wide bans ("G-Lines") */
+ case 'G':
+ case 'k': /* Server-local bans ("K-Lines") */
+ case 'K':
+ if (!Client_HasMode(from, 'o'))
+ return IRC_WriteStrClient(from, ERR_NOPRIVILEGES_MSG,
+ Client_ID(from));
+ if (query == 'g' || query == 'G')
+ 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,
+ Client_ID(from), query,
+ Lists_GetMask(list_item),
+ Lists_GetValidity(list_item),
+ Lists_GetReason(list_item)))
+ return DISCONNECTED;
+ list_item = Lists_GetNext(list_item);
+ }
+ break;
case 'l': /* Link status (servers and own link) */
case 'L':
time_now = time(NULL);
return DISCONNECTED;
/* Idle and signon time (local clients only!) */
- if (Client_Conn(c) > NONE &&
+ if (!Conf_MorePrivacy && Client_Conn(c) > NONE &&
!IRC_WriteStrClient(from, RPL_WHOISIDLE_MSG,
Client_ID(from), Client_ID(c),
(unsigned long)Conn_GetIdle(Client_Conn(c)),
assert( Client != NULL );
assert( Req != NULL );
+ /* Do not reveal any info on disconnected users? */
+ if (Conf_MorePrivacy)
+ return CONNECTED;
+
/* Wrong number of parameters? */
if (Req->argc > 3)
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
} /* IRC_WHOWAS */
+/**
+ * Send LUSERS reply to a client.
+ *
+ * @param Client The receipient of the information.
+ * @return CONNECTED or DISCONNECTED.
+ */
GLOBAL bool
-IRC_Send_LUSERS( CLIENT *Client )
+IRC_Send_LUSERS(CLIENT *Client)
{
unsigned long cnt;
#ifndef STRICT_RFC
unsigned long max;
#endif
- assert( Client != NULL );
+ assert(Client != NULL);
/* Users, services and serevers in the network */
- if( ! IRC_WriteStrClient( Client, RPL_LUSERCLIENT_MSG, Client_ID( Client ), Client_UserCount( ), Client_ServiceCount( ), Client_ServerCount( ))) return DISCONNECTED;
+ if (!IRC_WriteStrClient(Client, RPL_LUSERCLIENT_MSG, Client_ID(Client),
+ Client_UserCount(), Client_ServiceCount(),
+ Client_ServerCount()))
+ return DISCONNECTED;
/* Number of IRC operators */
cnt = Client_OperCount( );
- if( cnt > 0 )
- {
- if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
+ if (cnt > 0) {
+ if (!IRC_WriteStrClient(Client, RPL_LUSEROP_MSG,
+ Client_ID(Client), cnt))
+ return DISCONNECTED;
}
/* Unknown connections */
cnt = Client_UnknownCount( );
- if( cnt > 0 )
- {
- if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
+ if (cnt > 0) {
+ if (!IRC_WriteStrClient(Client, RPL_LUSERUNKNOWN_MSG,
+ Client_ID(Client), cnt))
+ return DISCONNECTED;
}
/* Number of created channels */
- if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
+ if (!IRC_WriteStrClient(Client, RPL_LUSERCHANNELS_MSG,
+ Client_ID(Client), Channel_Count()))
+ return DISCONNECTED;
/* Number of local users, services and servers */
- if( ! IRC_WriteStrClient( Client, RPL_LUSERME_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyServiceCount( ), Client_MyServerCount( ))) return DISCONNECTED;
+ if (!IRC_WriteStrClient(Client, RPL_LUSERME_MSG, Client_ID(Client),
+ Client_MyUserCount(), Client_MyServiceCount(),
+ Client_MyServerCount()))
+ return DISCONNECTED;
#ifndef STRICT_RFC
/* Maximum number of local users */
if( Channel_IsMemberOf( Chan, Client )) is_member = true;
else is_member = false;
+ /* Do not print info on channel memberships to anyone that is not member? */
+ if (Conf_MorePrivacy && !is_member)
+ return CONNECTED;
+
/* Secret channel? */
if( ! is_member && strchr( Channel_Modes( Chan ), 's' )) return CONNECTED;