Skip to content

Commit

Permalink
- Stylistic changes
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@8437 82007160-df01-0410-b94d-b575c5fd34c7
  • Loading branch information
michael committed Mar 29, 2018
1 parent 4cc36ed commit d6ba64f
Show file tree
Hide file tree
Showing 43 changed files with 159 additions and 176 deletions.
23 changes: 11 additions & 12 deletions include/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/
enum
{
STAT_CONNECTING,
STAT_CONNECTING = 1,
STAT_HANDSHAKE,
STAT_ME,
STAT_UNKNOWN,
Expand Down Expand Up @@ -251,9 +251,9 @@ enum
/*! \brief addr_mask_type enumeration */
enum addr_mask_type
{
HIDE_IP, /**< IP is hidden. Resolved hostname is shown instead */
SHOW_IP, /**< IP is shown. No parts of it are hidden or masked */
MASK_IP /**< IP is masked. 255.255.255.255 is shown instead */
HIDE_IP, /**< IP is hidden. Resolved hostname is shown instead */
SHOW_IP, /**< IP is shown. No parts of it are hidden or masked */
MASK_IP /**< IP is masked. 255.255.255.255 is shown instead */
};

struct ServicesTag
Expand All @@ -267,19 +267,19 @@ struct ServicesTag
/*! \brief Server structure */
struct Server
{
dlink_list server_list; /**< Servers on this server */
dlink_list client_list; /**< Clients on this server */
char by[NICKLEN + 1]; /**< Who activated this connection */
dlink_list server_list; /**< Servers on this server */
dlink_list client_list; /**< Clients on this server */
char by[NICKLEN + 1]; /**< Who activated this connection */
};

/*! \brief ListTask structure */
struct ListTask
{
dlink_node node; /**< Embedded list node used to link into listing_client_list */
dlink_list show_mask; /**< Channels to show */
dlink_list hide_mask; /**< Channels to hide */
dlink_list show_mask; /**< Channels to show */
dlink_list hide_mask; /**< Channels to hide */

unsigned int hash_index; /**< The hash bucket we are currently in */
unsigned int hash_index; /**< The hash bucket we are currently in */
unsigned int users_min;
unsigned int users_max;
unsigned int created_min;
Expand Down Expand Up @@ -464,5 +464,4 @@ extern struct Client *client_make(struct Client *);
extern struct Client *find_chasing(struct Client *, const char *);
extern struct Client *find_person(const struct Client *, const char *);
extern const char *client_get_name(const struct Client *, enum addr_mask_type);

#endif /* INCLUDED_client_h */
#endif /* INCLUDED_client_h */
12 changes: 6 additions & 6 deletions include/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ enum

enum maskitem_type
{
CONF_CLIENT = 1 << 0,
CONF_SERVER = 1 << 1,
CONF_KLINE = 1 << 2,
CONF_DLINE = 1 << 3,
CONF_EXEMPT = 1 << 4,
CONF_OPER = 1 << 5
CONF_CLIENT = 1,
CONF_SERVER,
CONF_KLINE,
CONF_DLINE,
CONF_EXEMPT,
CONF_OPER
};

#define IsConfKill(x) ((x)->type == CONF_KLINE)
Expand Down
4 changes: 2 additions & 2 deletions include/conf_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct ClassItem
extern struct ClassItem *class_default;

extern struct ClassItem *class_make(void);
extern const struct ClassItem *get_class_ptr(const dlink_list *const);
extern const struct ClassItem *class_get_ptr(const dlink_list *const);
extern const dlink_list *class_get_list(void);
extern void class_free(struct ClassItem *const);
extern void class_init(void);
Expand All @@ -79,4 +79,4 @@ extern void destroy_cidr_class(struct ClassItem *);
extern int cidr_limit_reached(int, struct irc_ssaddr *, struct ClassItem *);
extern void remove_from_cidr_check(struct irc_ssaddr *, struct ClassItem *);
extern void rebuild_cidr_list(struct ClassItem *);
#endif
#endif /* INCLUDED_conf_class_h */
39 changes: 21 additions & 18 deletions include/irc_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,26 @@ extern const unsigned char ToUpperTab[];

extern const unsigned int CharAttrs[];

#define PRINT_C 0x00001
#define CNTRL_C 0x00002
#define ALPHA_C 0x00004
#define PUNCT_C 0x00008
#define DIGIT_C 0x00010
#define SPACE_C 0x00020
#define NICK_C 0x00040
#define CHAN_C 0x00080
#define KWILD_C 0x00100
#define CHANPFX_C 0x00200
#define USER_C 0x00400
#define HOST_C 0x00800
#define NONEOS_C 0x01000
#define SERV_C 0x02000
#define EOL_C 0x04000
#define MWILD_C 0x08000
#define VCHAN_C 0x10000
enum
{
PRINT_C = 1 << 0,
CNTRL_C = 1 << 1,
ALPHA_C = 1 << 2,
PUNCT_C = 1 << 3,
DIGIT_C = 1 << 4,
SPACE_C = 1 << 5,
NICK_C = 1 << 6,
CHAN_C = 1 << 7,
KWILD_C = 1 << 8,
CHANPFX_C = 1 << 9,
USER_C = 1 << 10,
HOST_C = 1 << 11,
NONEOS_C = 1 << 12,
SERV_C = 1 << 13,
EOL_C = 1 << 14,
MWILD_C = 1 << 15,
VCHAN_C = 1 << 16
};

#define IsVisibleChanChar(c) (CharAttrs[(unsigned char)(c)] & VCHAN_C)
#define IsHostChar(c) (CharAttrs[(unsigned char)(c)] & HOST_C)
Expand Down Expand Up @@ -129,4 +132,4 @@ extern const unsigned int CharAttrs[];

#define IsNonEOS(c) (CharAttrs[(unsigned char)(c)] & NONEOS_C)
#define IsEol(c) (CharAttrs[(unsigned char)(c)] & EOL_C)
#endif /* INCLUDED_irc_string_h */
#endif /* INCLUDED_irc_string_h */
2 changes: 1 addition & 1 deletion include/motd.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ extern void motd_clear(void);
/* This is called to report motd {} blocks */
extern void motd_report(struct Client *, int, char *[]);
extern void motd_memory_count(struct Client *);
#endif
#endif /* INCLUDED_motd_h */
2 changes: 1 addition & 1 deletion include/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct server_hunt
struct Client *target_p;
};

extern int valid_servname(const char *);
extern int server_valid_name(const char *);
extern const struct server_hunt *server_hunt(struct Client *, const char *, const int, const int, char *[]);
extern void write_links_file(void *);
extern void read_links_file(void);
Expand Down
2 changes: 1 addition & 1 deletion include/server_capab.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ enum
/* Capabilities */
struct Capability
{
dlink_node node;
dlink_node node; /**< List node; linked into capab_list */
char *name; /**< Name of capability */
unsigned int cap; /**< Mask value */
};
Expand Down
7 changes: 3 additions & 4 deletions include/watch.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@
/*! \brief Watch structure */
struct Watch
{
dlink_node node; /**< Embedded dlink_node used to link into watchTable */
dlink_list watched_by; /**< List of clients that have this
entry on their watch list */
dlink_node node; /**< List node; linked into watchTable */
dlink_list watched_by; /**< List of clients that have this entry on their watch list */
uintmax_t lasttime; /**< Last time the client was seen */
char name[NICKLEN + 1]; /**< Name of the client to watch */
};
Expand All @@ -45,4 +44,4 @@ extern void watch_check_hash(const struct Client *, const enum irc_numerics);
extern void watch_del_watch_list(struct Client *);
extern void watch_count_memory(unsigned int *const, size_t *const);
extern struct Watch *watch_find_hash(const char *);
#endif
#endif /* INCLUDED_watch_h */
2 changes: 1 addition & 1 deletion include/whowas.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ extern void whowas_add_history(struct Client *, const int);
extern void whowas_off_history(struct Client *);
extern struct Client *whowas_get_history(const char *, uintmax_t);
extern void whowas_count_memory(unsigned int *const, size_t *const);
#endif /* INCLUDED_whowas_h */
#endif /* INCLUDED_whowas_h */
4 changes: 2 additions & 2 deletions modules/core/m_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ mo_kill(struct Client *source_p, int parc, char *parv[])
{
char buf[IRCD_BUFSIZE] = "";
char def_reason[] = CONF_NOREASON;
struct Client *target_p = NULL;

if (EmptyString(parv[1]))
{
Expand All @@ -74,6 +73,7 @@ mo_kill(struct Client *source_p, int parc, char *parv[])
else
reason = def_reason;

struct Client *target_p;
if ((target_p = hash_find_client(parv[1])) == NULL)
{
/*
Expand Down Expand Up @@ -167,14 +167,14 @@ ms_kill(struct Client *source_p, int parc, char *parv[])
{
char buf[IRCD_BUFSIZE] = "";
char def_reason[] = CONF_NOREASON;
struct Client *target_p = NULL;

if (parc < 3 || EmptyString(parv[2]))
{
sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "KILL");
return 0;
}

struct Client *target_p;
if ((target_p = find_person(source_p, parv[1])) == NULL)
return 0;

Expand Down
36 changes: 16 additions & 20 deletions modules/core/m_nick.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,8 @@ check_clean_host(struct Client *source_p, const char *nick, const char *host)
static void
set_initial_nick(struct Client *source_p, const char *nick)
{
const int samenick = !irccmp(source_p->name, nick);

if (!samenick)
int samenick = irccmp(source_p->name, nick) == 0;
if (samenick == 0)
source_p->tsinfo = CurrentTime;

source_p->connection->registration &= ~REG_NEED_NICK;
Expand All @@ -185,7 +184,7 @@ set_initial_nick(struct Client *source_p, const char *nick)
/* fd_desc is long enough */
fd_note(source_p->connection->fd, "Nick: %s", source_p->name);

if (!source_p->connection->registration)
if (source_p->connection->registration == 0)
register_local_user(source_p);
}

Expand Down Expand Up @@ -217,9 +216,8 @@ change_local_nick(struct Client *source_p, const char *nick)
source_p->connection->nick.last_attempt = CurrentTime;
source_p->connection->nick.count++;

int samenick = !irccmp(source_p->name, nick);

if (!samenick)
int samenick = irccmp(source_p->name, nick) == 0;
if (samenick == 0)
{
source_p->tsinfo = CurrentTime;
clear_ban_cache_list(&source_p->channel);
Expand Down Expand Up @@ -255,7 +253,7 @@ change_local_nick(struct Client *source_p, const char *nick)
strlcpy(source_p->name, nick, sizeof(source_p->name));
hash_add_client(source_p);

if (!samenick)
if (samenick == 0)
watch_check_hash(source_p, RPL_LOGON);

/* fd_desc is long enough */
Expand Down Expand Up @@ -283,9 +281,8 @@ change_remote_nick(struct Client *source_p, char *parv[])
assert(source_p->name[0]);

/* Client changing their nick */
int samenick = !irccmp(source_p->name, parv[1]);

if (!samenick)
int samenick = irccmp(source_p->name, parv[1]) == 0;
if (samenick == 0)
{
DelUMode(source_p, UMODE_REGISTERED);
watch_check_hash(source_p, RPL_LOGOFF);
Expand All @@ -309,7 +306,7 @@ change_remote_nick(struct Client *source_p, char *parv[])
strlcpy(source_p->name, parv[1], sizeof(source_p->name));
hash_add_client(source_p);

if (!samenick)
if (samenick == 0)
watch_check_hash(source_p, RPL_LOGON);
}

Expand Down Expand Up @@ -534,8 +531,8 @@ perform_nick_change_collides(struct Client *source_p, struct Client *target_p,
}

/* The timestamps are different */
int sameuser = !irccmp(target_p->username, source_p->username) &&
!irccmp(target_p->sockhost, source_p->sockhost);
int sameuser = irccmp(target_p->username, source_p->username) == 0 &&
irccmp(target_p->sockhost, source_p->sockhost) == 0;

if ((sameuser && newts < target_p->tsinfo) ||
(!sameuser && newts > target_p->tsinfo))
Expand Down Expand Up @@ -602,8 +599,6 @@ static int
mr_nick(struct Client *source_p, int parc, char *parv[])
{
char nick[NICKLEN + 1] = "";
struct Client *target_p = NULL;
const struct ResvItem *resv = NULL;

if (parc < 2 || EmptyString(parv[1]))
{
Expand All @@ -622,6 +617,7 @@ mr_nick(struct Client *source_p, int parc, char *parv[])
}

/* Check if the nick is resv'd */
const struct ResvItem *resv;
if ((resv = resv_find(nick, match)))
{
sendto_one_numeric(source_p, &me, ERR_ERRONEUSNICKNAME, nick, resv->reason);
Expand All @@ -631,6 +627,7 @@ mr_nick(struct Client *source_p, int parc, char *parv[])
return 0;
}

struct Client *target_p;
if ((target_p = hash_find_client(nick)) == NULL || target_p == source_p)
set_initial_nick(source_p, nick);
else
Expand All @@ -654,7 +651,6 @@ static int
m_nick(struct Client *source_p, int parc, char *parv[])
{
char nick[NICKLEN + 1] = "";
struct Client *target_p = NULL;
const struct ResvItem *resv = NULL;

assert(MyClient(source_p));
Expand Down Expand Up @@ -690,6 +686,7 @@ m_nick(struct Client *source_p, int parc, char *parv[])
return 0;
}

struct Client *target_p;
if ((target_p = hash_find_client(nick)) == NULL)
change_local_nick(source_p, nick);
else if (target_p == source_p)
Expand Down Expand Up @@ -735,8 +732,6 @@ m_nick(struct Client *source_p, int parc, char *parv[])
static int
ms_nick(struct Client *source_p, int parc, char *parv[])
{
struct Client *target_p = NULL;

if (parc != 3 || EmptyString(parv[parc - 1]))
return 0;

Expand All @@ -747,6 +742,7 @@ ms_nick(struct Client *source_p, int parc, char *parv[])
return 0;

/* If the nick doesn't exist, allow it and process like normal */
struct Client *target_p;
if ((target_p = hash_find_client(parv[1])) == NULL)
change_remote_nick(source_p, parv);
else if (IsUnknown(target_p))
Expand Down Expand Up @@ -802,7 +798,6 @@ ms_nick(struct Client *source_p, int parc, char *parv[])
static int
ms_uid(struct Client *source_p, int parc, char *parv[])
{
struct Client *target_p = NULL;
/* TBR: compatibility mode */
const int does_rhost = parc == 12;

Expand All @@ -821,6 +816,7 @@ ms_uid(struct Client *source_p, int parc, char *parv[])
* This may generate 401's, but it ensures that both clients always
* go, even if the other server refuses to do the right thing.
*/
struct Client *target_p;
if ((target_p = hash_find_id(parv[8 + does_rhost])))
{
sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
Expand Down
4 changes: 2 additions & 2 deletions modules/core/m_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ mr_server(struct Client *source_p, int parc, char *parv[])
return 0;
}

if (!valid_servname(name))
if (!server_valid_name(name))
{
sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
"Unauthorized server connection attempt from %s: Bogus server name "
Expand Down Expand Up @@ -660,7 +660,7 @@ ms_sid(struct Client *source_p, int parc, char *parv[])
return 0;
}

if (!valid_servname(parv[1]))
if (!server_valid_name(parv[1]))
{
sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
"Link %s introduced server with bogus server name %s",
Expand Down
2 changes: 1 addition & 1 deletion modules/m_cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ cap_end(struct Client *source_p, const char *caplist)
source_p->connection->registration &= ~REG_NEED_CAP;

/* If client is now done... */
if (!source_p->connection->registration)
if (source_p->connection->registration == 0)
{
register_local_user(source_p);
return 0;
Expand Down
Loading

0 comments on commit d6ba64f

Please sign in to comment.