diff --git a/include/h.h b/include/h.h index 6e1cf431e..73f49f18a 100644 --- a/include/h.h +++ b/include/h.h @@ -141,8 +141,8 @@ extern void append_ListItem(ListStruct *item, ListStruct **list); extern void add_ListItemPrio(ListStructPrio *, ListStructPrio **, int); extern void del_ListItem(ListStruct *, ListStruct **); extern MODVAR LoopStruct loop; -extern int del_banid(Channel *chptr, char *banid); -extern int del_exbanid(Channel *chptr, char *banid); +extern int del_banid(Channel *channel, char *banid); +extern int del_exbanid(Channel *channel, char *banid); #ifdef SHOWCONNECTINFO @@ -257,7 +257,7 @@ extern void sendto_message_one(Client *to, Client *from, char *sender, #define PREFIX_OP 0x4 #define PREFIX_ADMIN 0x08 #define PREFIX_OWNER 0x10 -extern void sendto_channel(Channel *chptr, Client *from, Client *skip, +extern void sendto_channel(Channel *channel, Client *from, Client *skip, int prefix, long clicap, int sendflags, MessageTag *mtags, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,8,9))); @@ -369,7 +369,7 @@ extern Channel *hash_get_chan_bucket(uint64_t); extern Client *hash_find_client(const char *, Client *); extern Client *hash_find_id(const char *, Client *); extern Client *hash_find_nickatserver(const char *, Client *); -extern Channel *hash_find_channel(char *name, Channel *chptr); +extern Channel *hash_find_channel(char *name, Channel *channel); extern Client *hash_find_server(const char *, Client *); extern struct MODVAR ThrottlingBucket *ThrottlingHash[THROTTLING_HASH_TABLE_SIZE]; @@ -633,15 +633,15 @@ extern char *spamfilter_inttostring_long(int v); extern Channel *get_channel(Client *cptr, char *chname, int flag); extern MODVAR char backupbuf[]; extern void add_invite(Client *, Client *, Channel *, MessageTag *); -extern void channel_modes(Client *cptr, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *chptr); +extern void channel_modes(Client *cptr, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *channel); extern MODVAR char modebuf[BUFSIZE], parabuf[BUFSIZE]; extern int op_can_override(char* acl, Client *client,Channel *channel,void* extra); extern Client *find_chasing(Client *client, char *user, int *chasing); extern MODVAR long opermode; extern MODVAR long sajoinmode; -extern void add_user_to_channel(Channel *chptr, Client *who, int flags); +extern void add_user_to_channel(Channel *channel, Client *who, int flags); extern int add_banid(Client *, Channel *, char *); -extern int add_exbanid(Client *cptr, Channel *chptr, char *banid); +extern int add_exbanid(Client *cptr, Channel *channel, char *banid); extern int sub1_from_channel(Channel *); extern MODVAR CoreChannelModeTable corechannelmodetable[]; extern char *unreal_encodespace(char *s); @@ -676,10 +676,10 @@ extern MODVAR int labeled_response_inhibit; /* Efuncs */ extern MODVAR void (*do_join)(Client *, int, char **); -extern MODVAR void (*join_channel)(Channel *chptr, Client *client, MessageTag *mtags, int flags); -extern MODVAR int (*can_join)(Client *client, Channel *chptr, char *key, char *parv[]); -extern MODVAR void (*do_mode)(Channel *chptr, Client *client, MessageTag *mtags, int parc, char *parv[], time_t sendts, int samode); -extern MODVAR void (*set_mode)(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcount, +extern MODVAR void (*join_channel)(Channel *channel, Client *client, MessageTag *mtags, int flags); +extern MODVAR int (*can_join)(Client *client, Channel *channel, char *key, char *parv[]); +extern MODVAR void (*do_mode)(Channel *channel, Client *client, MessageTag *mtags, int parc, char *parv[], time_t sendts, int samode); +extern MODVAR void (*set_mode)(Channel *channel, Client *cptr, int parc, char *parv[], u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce); extern MODVAR void (*cmd_umode)(Client *, MessageTag *, int, char **); extern MODVAR int (*register_user)(Client *client, char *nick, char *username, char *umode, char *virthost, char *ip); @@ -724,15 +724,15 @@ extern MODVAR void (*send_protoctl_servers)(Client *client, int response); extern MODVAR int (*verify_link)(Client *client, char *servername, ConfigItem_link **link_out); extern MODVAR void (*send_server_message)(Client *client); extern MODVAR void (*broadcast_md_client)(ModDataInfo *mdi, Client *acptr, ModData *md); -extern MODVAR void (*broadcast_md_channel)(ModDataInfo *mdi, Channel *chptr, ModData *md); -extern MODVAR void (*broadcast_md_member)(ModDataInfo *mdi, Channel *chptr, Member *m, ModData *md); +extern MODVAR void (*broadcast_md_channel)(ModDataInfo *mdi, Channel *channel, ModData *md); +extern MODVAR void (*broadcast_md_member)(ModDataInfo *mdi, Channel *channel, Member *m, ModData *md); extern MODVAR void (*broadcast_md_membership)(ModDataInfo *mdi, Client *acptr, Membership *m, ModData *md); extern MODVAR void (*broadcast_md_client_cmd)(Client *except, Client *sender, Client *acptr, char *varname, char *value); -extern MODVAR void (*broadcast_md_channel_cmd)(Client *except, Client *sender, Channel *chptr, char *varname, char *value); -extern MODVAR void (*broadcast_md_member_cmd)(Client *except, Client *sender, Channel *chptr, Client *acptr, char *varname, char *value); -extern MODVAR void (*broadcast_md_membership_cmd)(Client *except, Client *sender, Client *acptr, Channel *chptr, char *varname, char *value); +extern MODVAR void (*broadcast_md_channel_cmd)(Client *except, Client *sender, Channel *channel, char *varname, char *value); +extern MODVAR void (*broadcast_md_member_cmd)(Client *except, Client *sender, Channel *channel, Client *acptr, char *varname, char *value); +extern MODVAR void (*broadcast_md_membership_cmd)(Client *except, Client *sender, Client *acptr, Channel *channel, char *varname, char *value); extern MODVAR void (*send_moddata_client)(Client *srv, Client *acptr); -extern MODVAR void (*send_moddata_channel)(Client *srv, Channel *chptr); +extern MODVAR void (*send_moddata_channel)(Client *srv, Channel *channel); extern MODVAR void (*send_moddata_members)(Client *srv); extern MODVAR void (*broadcast_moddata_client)(Client *acptr); extern MODVAR int (*check_banned)(Client *cptr, int exitflags); @@ -741,14 +741,14 @@ extern MODVAR int (*check_deny_version)(Client *cptr, char *software, int protoc extern MODVAR int (*match_user)(char *rmask, Client *acptr, int options); extern MODVAR void (*userhost_save_current)(Client *client); extern MODVAR void (*userhost_changed)(Client *client); -extern MODVAR void (*send_join_to_local_users)(Client *client, Channel *chptr, MessageTag *mtags); +extern MODVAR void (*send_join_to_local_users)(Client *client, Channel *channel, MessageTag *mtags); extern MODVAR int (*do_nick_name)(char *nick); extern MODVAR int (*do_remote_nick_name)(char *nick); extern MODVAR char *(*charsys_get_current_languages)(void); extern MODVAR void (*broadcast_sinfo)(Client *acptr, Client *to, Client *except); extern MODVAR void (*parse_message_tags)(Client *cptr, char **str, MessageTag **mtag_list); extern MODVAR char *(*mtags_to_string)(MessageTag *m, Client *acptr); -extern MODVAR int (*can_send)(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int notice); +extern MODVAR int (*can_send)(Client *cptr, Channel *channel, char **msgtext, char **errmsg, int notice); extern MODVAR void (*broadcast_md_globalvar)(ModDataInfo *mdi, ModData *md); extern MODVAR void (*broadcast_md_globalvar_cmd)(Client *except, Client *sender, char *varname, char *value); extern MODVAR int (*tkl_ip_hash)(char *ip); @@ -761,12 +761,12 @@ extern MODVAR int (*is_silenced)(Client *client, Client *acptr); extern MODVAR MOTDFile opermotd, svsmotd, motd, botmotd, smotd, rules; extern MODVAR int max_connection_count; -extern int add_listmode(Ban **list, Client *cptr, Channel *chptr, char *banid); -extern int add_listmode_ex(Ban **list, Client *cptr, Channel *chptr, char *banid, char *setby, time_t seton); -extern int del_listmode(Ban **list, Channel *chptr, char *banid); +extern int add_listmode(Ban **list, Client *cptr, Channel *channel, char *banid); +extern int add_listmode_ex(Ban **list, Client *cptr, Channel *channel, char *banid, char *setby, time_t seton); +extern int del_listmode(Ban **list, Channel *channel, char *banid); extern int Halfop_mode(long mode); extern char *clean_ban_mask(char *, int, Client *); -extern int find_invex(Channel *chptr, Client *client); +extern int find_invex(Channel *channel, Client *client); extern void DoMD5(unsigned char *mdout, const unsigned char *src, unsigned long n); extern char *md5hash(unsigned char *dst, const unsigned char *src, unsigned long n); extern MODVAR TKL *tklines[TKLISTLEN]; @@ -783,9 +783,9 @@ extern char *unreal_time_synch_error(void); extern int unreal_time_synch(int timeout); extern char *getcloak(Client *client); extern MODVAR unsigned char param_to_slot_mapping[256]; -extern char *cm_getparameter(Channel *chptr, char mode); -extern void cm_putparameter(Channel *chptr, char mode, char *str); -extern void cm_freeparameter(Channel *chptr, char mode); +extern char *cm_getparameter(Channel *channel, char mode); +extern void cm_putparameter(Channel *channel, char mode, char *str); +extern void cm_freeparameter(Channel *channel, char mode); extern char *cm_getparameter_ex(void **p, char mode); extern void cm_putparameter_ex(void **p, char mode, char *str); extern void cm_freeparameter_ex(void **p, char mode, char *str); @@ -844,7 +844,7 @@ extern MODVAR Client *remote_rehash_client; extern MODVAR int debugfd; extern void convert_to_absolute_path(char **path, char *reldir); extern int has_user_mode(Client *acptr, char mode); -extern int has_channel_mode(Channel *chptr, char mode); +extern int has_channel_mode(Channel *channel, char mode); extern Cmode_t get_extmode_bitbychar(char m); extern long get_mode_bitbychar(char m); extern long find_user_mode(char mode); @@ -868,8 +868,8 @@ extern void cmd_alias(Client *client, MessageTag *recv_mtags, int parc, char *pa extern void ban_flooder(Client *cptr); extern char *pcre2_version(void); extern int has_common_channels(Client *c1, Client *c2); -extern int user_can_see_member(Client *user, Client *target, Channel *chptr); -extern int invisible_user_in_channel(Client *target, Channel *chptr); +extern int user_can_see_member(Client *user, Client *target, Channel *channel); +extern int invisible_user_in_channel(Client *target, Channel *channel); extern MODVAR int ssl_client_index; extern TLSOptions *FindTLSOptionsForUser(Client *acptr); extern int IsWebsocket(Client *acptr); diff --git a/include/modules.h b/include/modules.h index fd9dfbb29..23b10f7bc 100644 --- a/include/modules.h +++ b/include/modules.h @@ -155,7 +155,7 @@ struct ModDataInfo { #define moddata_client(acptr, md) acptr->moddata[md->slot] #define moddata_local_client(acptr, md) acptr->local->moddata[md->slot] -#define moddata_channel(chptr, md) chptr->moddata[md->slot] +#define moddata_channel(channel, md) channel->moddata[md->slot] #define moddata_member(m, md) m->moddata[md->slot] #define moddata_membership(m, md) m->moddata[md->slot] #define moddata_local_variable(md) local_variable_moddata[md->slot] @@ -215,7 +215,7 @@ typedef struct { /** NOTE: The routines below are NULL for paramless modes */ /** Store parameter in memory for channel. - * aExtCMtableParam *: the list (usually chptr->mode.extmodeparams). + * aExtCMtableParam *: the list (usually channel->mode.extmodeparams). * char *: the parameter. * return value: the head of the list, RTFS if you wonder why. * design notes: only alloc a new paramstruct if you need to, search for @@ -224,7 +224,7 @@ typedef struct { void * (*put_param)(void *, char *); /** Get readable string version" of the stored parameter. - * aExtCMtableParam *: the list (usually chptr->mode.extmodeparams). + * aExtCMtableParam *: the list (usually channel->mode.extmodeparams). * return value: a pointer to the string (temp. storage) */ char * (*get_param)(void *); @@ -241,7 +241,7 @@ typedef struct { char * (*conv_param)(char *, Client *); /** free and remove parameter from list. - * aExtCMtableParam *: the list (usually chptr->mode.extmodeparams). + * aExtCMtableParam *: the list (usually channel->mode.extmodeparams). */ void (*free_param)(void *); @@ -301,14 +301,14 @@ typedef struct { /* Get a slot# for a param.. eg... GETPARAMSLOT('k') ;p */ #define GETPARAMSLOT(x) param_to_slot_mapping[x] -/* Get a cmode handler by slot.. for example for [dont use this]: GETPARAMHANDLERBYSLOT(5)->get_param(chptr) */ +/* Get a cmode handler by slot.. for example for [dont use this]: GETPARAMHANDLERBYSLOT(5)->get_param(channel) */ #define GETPARAMHANDLERBYSLOT(slotid) ParamTable[slotid] -/* Same as GETPARAMHANDLERBYSLOT but then by letter.. like [dont use this]: GETPARAMHANDLERBYSLOT('k')->get_param(chptr) */ +/* Same as GETPARAMHANDLERBYSLOT but then by letter.. like [dont use this]: GETPARAMHANDLERBYSLOT('k')->get_param(channel) */ #define GETPARAMHANDLERBYLETTER(x) ParamTable[GETPARAMSLOT(x)] -/* Get paramter data struct.. for like: ((aModejEntry *)GETPARASTRUCT(chptr, 'j'))->t */ -#define GETPARASTRUCT(mychptr, mychar) chptr->mode.extmodeparams[GETPARAMSLOT(mychar)] +/* Get paramter data struct.. for like: ((aModejEntry *)GETPARASTRUCT(channel, 'j'))->t */ +#define GETPARASTRUCT(mychannel, mychar) channel->mode.extmodeparams[GETPARAMSLOT(mychar)] #define GETPARASTRUCTEX(v, mychar) v[GETPARAMSLOT(mychar)] @@ -371,7 +371,7 @@ typedef struct { * char **: optionally a message, can be NULL!! (for some BANCHK_ types) * char **: optionally for setting an error message, can be NULL!! */ - int (*is_banned)(Client *client, Channel *chptr, char *para, int checktype, char **msg, char **errormsg); + int (*is_banned)(Client *client, Channel *channel, char *para, int checktype, char **msg, char **errormsg); } Extban; typedef struct { @@ -846,7 +846,7 @@ extern void CallCommandOverride(CommandOverride *ovr, Client *client, MessageTag extern void moddata_free_client(Client *acptr); extern void moddata_free_local_client(Client *acptr); -extern void moddata_free_channel(Channel *chptr); +extern void moddata_free_channel(Channel *channel); extern void moddata_free_member(Member *m); extern void moddata_free_membership(Membership *m); extern ModDataInfo *findmoddata_byname(char *name, ModDataType type); @@ -994,38 +994,38 @@ int hooktype_pre_local_connect(Client *client); int hooktype_server_quit(Client *client, MessageTag *mtags); int hooktype_local_nickchange(Client *client, char *newnick); int hooktype_remote_nickchange(Client *client, char *newnick); -int hooktype_can_join(Client *client, Channel *chptr, char *key, char *parv[]); -int hooktype_pre_local_join(Client *client, Channel *chptr, char *parv[]); -int hooktype_local_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]); -int hooktype_remote_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]); -char *hooktype_pre_local_part(Client *client, Channel *chptr, char *comment); -int hooktype_local_part(Client *client, Channel *chptr, MessageTag *mtags, char *comment); -int hooktype_remote_part(Client *client, Channel *chptr, MessageTag *mtags, char *comment); -char *hooktype_pre_local_kick(Client *client, Client *victim, Channel *chptr, char *comment); -int hooktype_can_kick(Client *client, Client *victim, Channel *chptr, char *comment, long client_flags, long victim_flags, char **error); -int hooktype_local_kick(Client *client, Client *victim, Channel *chptr, MessageTag *mtags, char *comment); -int hooktype_remote_kick(Client *client, Client *victim, Channel *chptr, MessageTag *mtags, char *comment); +int hooktype_can_join(Client *client, Channel *channel, char *key, char *parv[]); +int hooktype_pre_local_join(Client *client, Channel *channel, char *parv[]); +int hooktype_local_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]); +int hooktype_remote_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]); +char *hooktype_pre_local_part(Client *client, Channel *channel, char *comment); +int hooktype_local_part(Client *client, Channel *channel, MessageTag *mtags, char *comment); +int hooktype_remote_part(Client *client, Channel *channel, MessageTag *mtags, char *comment); +char *hooktype_pre_local_kick(Client *client, Client *victim, Channel *channel, char *comment); +int hooktype_can_kick(Client *client, Client *victim, Channel *channel, char *comment, long client_flags, long victim_flags, char **error); +int hooktype_local_kick(Client *client, Client *victim, Channel *channel, MessageTag *mtags, char *comment); +int hooktype_remote_kick(Client *client, Client *victim, Channel *channel, MessageTag *mtags, char *comment); char *hooktype_pre_usermsg(Client *client, Client *to, char *text, int notice); int hooktype_usermsg(Client *client, Client *to, MessageTag *mtags, char *text, int notice); -int hooktype_can_send(Client *client, Channel *chptr, Membership *member, char **text, char **errmsg, int notice); -char *hooktype_pre_chanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice); -int hooktype_chanmsg(Client *client, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice); -char *hooktype_pre_local_topic(Client *client, Channel *chptr, char *topic); -int hooktype_local_topic(Client *client, Channel *chptr, char *topic); -int hooktype_topic(Client *client, Channel *chptr, char *topic); -int hooktype_pre_local_chanmode(Client *client, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); -int hooktype_pre_remote_chanmode(Client *client, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); -int hooktype_local_chanmode(Client *client, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); -int hooktype_remote_chanmode(Client *client, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); -int hooktype_modechar_del(Channel *chptr, int modechar); -int hooktype_modechar_add(Channel *chptr, int modechar); +int hooktype_can_send(Client *client, Channel *channel, Membership *member, char **text, char **errmsg, int notice); +char *hooktype_pre_chanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice); +int hooktype_chanmsg(Client *client, Channel *channel, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice); +char *hooktype_pre_local_topic(Client *client, Channel *channel, char *topic); +int hooktype_local_topic(Client *client, Channel *channel, char *topic); +int hooktype_topic(Client *client, Channel *channel, char *topic); +int hooktype_pre_local_chanmode(Client *client, Channel *channel, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); +int hooktype_pre_remote_chanmode(Client *client, Channel *channel, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); +int hooktype_local_chanmode(Client *client, Channel *channel, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); +int hooktype_remote_chanmode(Client *client, Channel *channel, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); +int hooktype_modechar_del(Channel *channel, int modechar); +int hooktype_modechar_add(Channel *channel, int modechar); int hooktype_away(Client *client, MessageTag *mtags, char *reason); -int hooktype_pre_invite(Client *client, Client *acptr, Channel *chptr, int *override); -int hooktype_invite(Client *from, Client *to, Channel *chptr, MessageTag *mtags); -int hooktype_pre_knock(Client *client, Channel *chptr); -int hooktype_knock(Client *client, Channel *chptr, MessageTag *mtags, char *comment); +int hooktype_pre_invite(Client *client, Client *acptr, Channel *channel, int *override); +int hooktype_invite(Client *from, Client *to, Channel *channel, MessageTag *mtags); +int hooktype_pre_knock(Client *client, Channel *channel); +int hooktype_knock(Client *client, Channel *channel, MessageTag *mtags, char *comment); int hooktype_whois(Client *client, Client *target); -int hooktype_who_status(Client *client, Client *target, Channel *chptr, Member *member, char *status, int cansee); +int hooktype_who_status(Client *client, Client *target, Channel *channel, Member *member, char *status, int cansee); int hooktype_pre_kill(Client *client, Client *victim, char *killpath); int hooktype_local_kill(Client *client, Client *victim, char *comment); int hooktype_rehashflag(Client *client, char *str); @@ -1037,8 +1037,8 @@ int hooktype_configrun(ConfigFile *cfptr, ConfigEntry *ce, int section); int hooktype_configrun_ex(ConfigFile *cfptr, ConfigEntry *ce, int section, void *ptr); int hooktype_local_oper(Client *client, int add); int hooktype_local_pass(Client *client, char *password); -int hooktype_channel_create(Client *client, Channel *chptr); -int hooktype_channel_destroy(Channel *chptr, int *should_destroy); +int hooktype_channel_create(Client *client, Channel *channel); +int hooktype_channel_destroy(Channel *channel, int *should_destroy); int hooktype_tkl_except(Client *cptr, int ban_type); int hooktype_umode_change(Client *client, long setflags, long newflags); int hooktype_rehash_complete(void); @@ -1053,24 +1053,24 @@ int hooktype_packet(Client *from, Client *to, Client *intended_to, char **msg, i int hooktype_handshake(Client *client); int hooktype_free_client(Client *acptr); int hooktype_free_user(ClientUser *user, Client *acptr); -int hooktype_can_join_limitexceeded(Client *client, Channel *chptr, char *key, char *parv[]); -int hooktype_visible_in_channel(Client *client, Channel *chptr); -int hooktype_join_data(Client *who, Channel *chptr); -int hooktype_oper_invite_ban(Client *client, Channel *chptr); -int hooktype_view_topic_outside_channel(Client *client, Channel *chptr); -int hooktype_chan_permit_nick_change(Client *client, Channel *chptr); -int hooktype_is_channel_secure(Channel *chptr); -int hooktype_can_send_secure(Client *client, Channel *chptr); -int hooktype_channel_synced(Channel *chptr, int merge, int removetheirs, int nomode); -int hooktype_can_sajoin(Client *target, Channel *chptr, Client *client); +int hooktype_can_join_limitexceeded(Client *client, Channel *channel, char *key, char *parv[]); +int hooktype_visible_in_channel(Client *client, Channel *channel); +int hooktype_join_data(Client *who, Channel *channel); +int hooktype_oper_invite_ban(Client *client, Channel *channel); +int hooktype_view_topic_outside_channel(Client *client, Channel *channel); +int hooktype_chan_permit_nick_change(Client *client, Channel *channel); +int hooktype_is_channel_secure(Channel *channel); +int hooktype_can_send_secure(Client *client, Channel *channel); +int hooktype_channel_synced(Channel *channel, int merge, int removetheirs, int nomode); +int hooktype_can_sajoin(Client *target, Channel *channel, Client *client); int hooktype_check_init(Client *cptr, char *sockname, size_t size); -int hooktype_mode_deop(Client *client, Client *victim, Channel *chptr, u_int what, int modechar, long my_access, char **badmode); -int hooktype_see_channel_in_whois(Client *client, Client *target, Channel *chptr); +int hooktype_mode_deop(Client *client, Client *victim, Channel *channel, u_int what, int modechar, long my_access, char **badmode); +int hooktype_see_channel_in_whois(Client *client, Client *target, Channel *channel); int hooktype_dcc_denied(Client *client, Client *target, char *realfile, char *displayfile, ConfigItem_deny_dcc *denydcc); int hooktype_server_handshake_out(Client *client); int hooktype_server_synched(Client *client); int hooktype_secure_connect(Client *client); -int hooktype_can_bypass_channel_message_restriction(Client *client, Channel *chptr, BypassChannelMessageRestrictionType bypass_type); +int hooktype_can_bypass_channel_message_restriction(Client *client, Channel *channel, BypassChannelMessageRestrictionType bypass_type); int hooktype_require_sasl(Client *client, char *reason); int hooktype_sasl_continuation(Client *client, char *buf); int hooktype_sasl_result(Client *client, int success); @@ -1081,7 +1081,7 @@ int hooktype_pre_command(Client *from, MessageTag *mtags, char *buf); int hooktype_post_command(Client *from, MessageTag *mtags, char *buf); void hooktype_new_message(Client *sender, MessageTag *recv_mtags, MessageTag **mtag_list, char *signature); int hooktype_is_handshake_finished(Client *acptr); -char *hooktype_pre_local_quit_chan(Client *client, Channel *chptr, char *comment); +char *hooktype_pre_local_quit_chan(Client *client, Channel *channel, char *comment); int hooktype_ident_lookup(Client *acptr); #ifdef GCC_TYPECHECKING diff --git a/include/struct.h b/include/struct.h index 2dba14c3b..6b27b5718 100644 --- a/include/struct.h +++ b/include/struct.h @@ -1810,7 +1810,7 @@ struct Link { int flags; union { Client *client; - Channel *chptr; + Channel *channel; Watch *wptr; /* there used to be 'char *cp' here too, * but in such a case you better use NameList @@ -1845,8 +1845,8 @@ struct Channel { char chname[1]; /**< Channel name */ }; -/** user/channel member struct (chptr->members). - * This is Member which is used in the linked list chptr->members for each channel. +/** user/channel member struct (channel->members). + * This is Member which is used in the linked list channel->members for each channel. * There is also Membership which is used in client->user->channels (see Membership for that). * Both must be kept synchronized 100% at all times. */ @@ -1860,13 +1860,13 @@ struct Member /** user/channel membership struct (client->user->channels). * This is Membership which is used in the linked list client->user->channels for each user. - * There is also Member which is used in chptr->members (see Member for that). + * There is also Member which is used in channel->members (see Member for that). * Both must be kept synchronized 100% at all times. */ struct Membership { struct Membership *next; /**< Next entry in list */ - struct Channel *chptr; /**< The channel */ + struct Channel *channel; /**< The channel */ int flags; /**< The access of the user on this channel (one or more of CHFL_*) */ ModData moddata[MODDATA_MAX_MEMBERSHIP]; /**< Membership attached module data, used by the ModData system */ }; @@ -1901,17 +1901,17 @@ struct Ban { * @{ */ /** Is channel owner (+q) */ -#define is_chanowner(cptr,chptr) (get_access(cptr,chptr) & CHFL_CHANOWNER) +#define is_chanowner(cptr,channel) (get_access(cptr,channel) & CHFL_CHANOWNER) /** Is channel admin (+a) */ -#define is_chanadmin(cptr,chptr) (get_access(cptr,chptr) & CHFL_CHANADMIN) +#define is_chanadmin(cptr,channel) (get_access(cptr,channel) & CHFL_CHANADMIN) /** Is channel operator or higher (+o/+a/+q) */ -#define is_chan_op(cptr,chptr) (get_access(cptr,chptr) & CHFL_CHANOP_OR_HIGHER) +#define is_chan_op(cptr,channel) (get_access(cptr,channel) & CHFL_CHANOP_OR_HIGHER) /** Is some kind of channel op (+h/+o/+a/+q) */ -#define is_skochanop(cptr,chptr) (get_access(cptr,chptr) & CHFL_HALFOP_OR_HIGHER) +#define is_skochanop(cptr,channel) (get_access(cptr,channel) & CHFL_HALFOP_OR_HIGHER) /** Is half-op (+h) */ -#define is_half_op(cptr,chptr) (get_access(cptr,chptr) & CHFL_HALFOP) +#define is_half_op(cptr,channel) (get_access(cptr,channel) & CHFL_HALFOP) /** Has voice (+v) */ -#define has_voice(cptr,chptr) (get_access(cptr,chptr) & CHFL_VOICE) +#define has_voice(cptr,channel) (get_access(cptr,channel) & CHFL_VOICE) #define CHFL_CHANOWNER 0x0040 /**< Channel owner (+q) */ #define CHFL_CHANADMIN 0x0080 /**< Channel admin (+a) */ #define CHFL_CHANOP 0x0001 /**< Channel operator (+o) */ diff --git a/src/aliases.c b/src/aliases.c index 2d4701526..1ed01808b 100644 --- a/src/aliases.c +++ b/src/aliases.c @@ -105,20 +105,20 @@ void cmd_alias(Client *client, MessageTag *mtags, int parc, char *parv[], char * } else if (alias->type == ALIAS_CHANNEL) { - Channel *chptr; - if ((chptr = find_channel(alias->nick, NULL))) + Channel *channel; + if ((channel = find_channel(alias->nick, NULL))) { char *msg = parv[1]; char *errmsg = NULL; - if (!can_send(client, chptr, &msg, &errmsg, 0)) + if (!can_send(client, channel, &msg, &errmsg, 0)) { - if (alias->spamfilter && match_spamfilter(client, parv[1], SPAMF_CHANMSG, chptr->chname, 0, NULL)) + if (alias->spamfilter && match_spamfilter(client, parv[1], SPAMF_CHANMSG, channel->chname, 0, NULL)) return; new_message(client, NULL, &mtags); - sendto_channel(chptr, client, client, + sendto_channel(channel, client, client, PREFIX_ALL, 0, SEND_ALL|SKIP_DEAF, mtags, ":%s PRIVMSG %s :%s", - client->name, chptr->chname, parv[1]); + client->name, channel->chname, parv[1]); free_message_tags(mtags); return; } @@ -240,20 +240,20 @@ void cmd_alias(Client *client, MessageTag *mtags, int parc, char *parv[], char * } else if (format->type == ALIAS_CHANNEL) { - Channel *chptr; - if ((chptr = find_channel(format->nick, NULL))) + Channel *channel; + if ((channel = find_channel(format->nick, NULL))) { char *msg = output; char *errmsg = NULL; - if (!can_send(client, chptr, &msg, &errmsg, 0)) + if (!can_send(client, channel, &msg, &errmsg, 0)) { - if (alias->spamfilter && match_spamfilter(client, output, SPAMF_CHANMSG, chptr->chname, 0, NULL)) + if (alias->spamfilter && match_spamfilter(client, output, SPAMF_CHANMSG, channel->chname, 0, NULL)) return; new_message(client, NULL, &mtags); - sendto_channel(chptr, client, client, + sendto_channel(channel, client, client, PREFIX_ALL, 0, SEND_ALL|SKIP_DEAF, mtags, ":%s PRIVMSG %s :%s", - client->name, chptr->chname, parv[1]); + client->name, channel->chname, parv[1]); free_message_tags(mtags); return; } diff --git a/src/api-channelmode.c b/src/api-channelmode.c index 310ac86fb..d5f6232b7 100644 --- a/src/api-channelmode.c +++ b/src/api-channelmode.c @@ -267,7 +267,7 @@ Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode) static void unload_extcmode_commit(Cmode *cmode) { - Channel *chptr; + Channel *channel; if (!cmode) return; @@ -277,55 +277,55 @@ static void unload_extcmode_commit(Cmode *cmode) if (cmode->paracount == 0) { /* Paramless mode, easy */ - for (chptr = channels; chptr; chptr = chptr->nextch) + for (channel = channels; channel; channel = channel->nextch) { - if (chptr->mode.extmode && cmode->mode) + if (channel->mode.extmode && cmode->mode) { MessageTag *mtags = NULL; new_message(&me, NULL, &mtags); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -%c", - me.name, chptr->chname, cmode->flag); + me.name, channel->chname, cmode->flag); sendto_server(NULL, 0, 0, mtags, ":%s MODE %s -%c 0", - me.name, chptr->chname, cmode->flag); + me.name, channel->chname, cmode->flag); free_message_tags(mtags); - chptr->mode.extmode &= ~cmode->mode; + channel->mode.extmode &= ~cmode->mode; } } } else { /* Parameter mode, more complicated */ - for (chptr = channels; chptr; chptr = chptr->nextch) + for (channel = channels; channel; channel = channel->nextch) { - if (chptr->mode.extmode && cmode->mode) + if (channel->mode.extmode && cmode->mode) { MessageTag *mtags = NULL; new_message(&me, NULL, &mtags); if (cmode->unset_with_param) { - char *param = cmode->get_param(GETPARASTRUCT(chptr, cmode->flag)); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, + char *param = cmode->get_param(GETPARASTRUCT(channel, cmode->flag)); + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -%c %s", - me.name, chptr->chname, cmode->flag, param); + me.name, channel->chname, cmode->flag, param); sendto_server(NULL, 0, 0, mtags, ":%s MODE %s -%c %s 0", - me.name, chptr->chname, cmode->flag, param); + me.name, channel->chname, cmode->flag, param); } else { - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -%c", - me.name, chptr->chname, cmode->flag); + me.name, channel->chname, cmode->flag); sendto_server(NULL, 0, 0, mtags, ":%s MODE %s -%c 0", - me.name, chptr->chname, cmode->flag); + me.name, channel->chname, cmode->flag); } free_message_tags(mtags); - cmode->free_param(GETPARASTRUCT(chptr, cmode->flag)); - chptr->mode.extmode &= ~cmode->mode; + cmode->free_param(GETPARASTRUCT(channel, cmode->flag)); + channel->mode.extmode &= ~cmode->mode; } } } @@ -400,20 +400,20 @@ void extcmode_free_paramlist(void **ar) } } -char *cm_getparameter(Channel *chptr, char mode) +char *cm_getparameter(Channel *channel, char mode) { - return GETPARAMHANDLERBYLETTER(mode)->get_param(GETPARASTRUCT(chptr, mode)); + return GETPARAMHANDLERBYLETTER(mode)->get_param(GETPARASTRUCT(channel, mode)); } -void cm_putparameter(Channel *chptr, char mode, char *str) +void cm_putparameter(Channel *channel, char mode, char *str) { - GETPARASTRUCT(chptr, mode) = GETPARAMHANDLERBYLETTER(mode)->put_param(GETPARASTRUCT(chptr, mode), str); + GETPARASTRUCT(channel, mode) = GETPARAMHANDLERBYLETTER(mode)->put_param(GETPARASTRUCT(channel, mode), str); } -void cm_freeparameter(Channel *chptr, char mode) +void cm_freeparameter(Channel *channel, char mode) { - GETPARAMHANDLERBYLETTER(mode)->free_param(GETPARASTRUCT(chptr, mode)); - GETPARASTRUCT(chptr, mode) = NULL; + GETPARAMHANDLERBYLETTER(mode)->free_param(GETPARASTRUCT(channel, mode)); + GETPARASTRUCT(channel, mode) = NULL; } char *cm_getparameter_ex(void **p, char mode) @@ -432,19 +432,19 @@ void cm_freeparameter_ex(void **p, char mode, char *str) GETPARASTRUCTEX(p, mode) = NULL; } -int extcmode_default_requirechop(Client *client, Channel *chptr, char mode, char *para, int checkt, int what) +int extcmode_default_requirechop(Client *client, Channel *channel, char mode, char *para, int checkt, int what) { - if (IsUser(client) && is_chan_op(client, chptr)) + if (IsUser(client) && is_chan_op(client, channel)) return EX_ALLOW; if (checkt == EXCHK_ACCESS_ERR) /* can only be due to being halfop */ sendnumeric(client, ERR_NOTFORHALFOPS, mode); return EX_DENY; } -int extcmode_default_requirehalfop(Client *client, Channel *chptr, char mode, char *para, int checkt, int what) +int extcmode_default_requirehalfop(Client *client, Channel *channel, char mode, char *para, int checkt, int what) { if (IsUser(client) && - (is_chan_op(client, chptr) || is_half_op(client, chptr))) + (is_chan_op(client, channel) || is_half_op(client, channel))) return EX_ALLOW; return EX_DENY; } diff --git a/src/api-efunctions.c b/src/api-efunctions.c index c844a0e2f..6e7df3eff 100644 --- a/src/api-efunctions.c +++ b/src/api-efunctions.c @@ -35,10 +35,10 @@ static EfunctionsList efunction_table[MAXEFUNCTIONS]; /* Efuncs */ void (*do_join)(Client *client, int parc, char *parv[]); -void (*join_channel)(Channel *chptr, Client *client, MessageTag *mtags, int flags); -int (*can_join)(Client *client, Channel *chptr, char *key, char *parv[]); -void (*do_mode)(Channel *chptr, Client *client, MessageTag *mtags, int parc, char *parv[], time_t sendts, int samode); -void (*set_mode)(Channel *chptr, Client *client, int parc, char *parv[], u_int *pcount, +void (*join_channel)(Channel *channel, Client *client, MessageTag *mtags, int flags); +int (*can_join)(Client *client, Channel *channel, char *key, char *parv[]); +void (*do_mode)(Channel *channel, Client *client, MessageTag *mtags, int parc, char *parv[], time_t sendts, int samode); +void (*set_mode)(Channel *channel, Client *client, int parc, char *parv[], u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce); void (*cmd_umode)(Client *client, MessageTag *mtags, int parc, char *parv[]); int (*register_user)(Client *client, char *nick, char *username, char *umode, char *virthost, char *ip); @@ -77,23 +77,23 @@ int (*verify_link)(Client *client, char *servername, ConfigItem_link **link_out) void (*introduce_user)(Client *to, Client *client); void (*send_server_message)(Client *client); void (*broadcast_md_client)(ModDataInfo *mdi, Client *client, ModData *md); -void (*broadcast_md_channel)(ModDataInfo *mdi, Channel *chptr, ModData *md); -void (*broadcast_md_member)(ModDataInfo *mdi, Channel *chptr, Member *m, ModData *md); +void (*broadcast_md_channel)(ModDataInfo *mdi, Channel *channel, ModData *md); +void (*broadcast_md_member)(ModDataInfo *mdi, Channel *channel, Member *m, ModData *md); void (*broadcast_md_membership)(ModDataInfo *mdi, Client *client, Membership *m, ModData *md); int (*check_banned)(Client *client, int exitflags); int (*check_deny_version)(Client *client, char *software, int protocol, char *flags); void (*broadcast_md_client_cmd)(Client *except, Client *sender, Client *acptr, char *varname, char *value); -void (*broadcast_md_channel_cmd)(Client *except, Client *sender, Channel *chptr, char *varname, char *value); -void (*broadcast_md_member_cmd)(Client *except, Client *sender, Channel *chptr, Client *acptr, char *varname, char *value); -void (*broadcast_md_membership_cmd)(Client *except, Client *sender, Client *acptr, Channel *chptr, char *varname, char *value); +void (*broadcast_md_channel_cmd)(Client *except, Client *sender, Channel *channel, char *varname, char *value); +void (*broadcast_md_member_cmd)(Client *except, Client *sender, Channel *channel, Client *acptr, char *varname, char *value); +void (*broadcast_md_membership_cmd)(Client *except, Client *sender, Client *acptr, Channel *channel, char *varname, char *value); void (*send_moddata_client)(Client *srv, Client *client); -void (*send_moddata_channel)(Client *srv, Channel *chptr); +void (*send_moddata_channel)(Client *srv, Channel *channel); void (*send_moddata_members)(Client *srv); void (*broadcast_moddata_client)(Client *client); int (*match_user)(char *rmask, Client *client, int options); void (*userhost_changed)(Client *client); void (*userhost_save_current)(Client *client); -void (*send_join_to_local_users)(Client *client, Channel *chptr, MessageTag *mtags); +void (*send_join_to_local_users)(Client *client, Channel *channel, MessageTag *mtags); int (*do_nick_name)(char *nick); int (*do_remote_nick_name)(char *nick); char *(*charsys_get_current_languages)(void); @@ -102,7 +102,7 @@ void (*parse_message_tags)(Client *client, char **str, MessageTag **mtag_list); extern void parse_message_tags_default_handler(Client *client, char **str, MessageTag **mtag_list); char *(*mtags_to_string)(MessageTag *m, Client *client); extern char *mtags_to_string_default_handler(MessageTag *m, Client *client); -int (*can_send)(Client *client, Channel *chptr, char **msgtext, char **errmsg, int notice); +int (*can_send)(Client *client, Channel *channel, char **msgtext, char **errmsg, int notice); void (*broadcast_md_globalvar)(ModDataInfo *mdi, ModData *md); void (*broadcast_md_globalvar_cmd)(Client *except, Client *sender, char *varname, char *value); int (*tkl_ip_hash)(char *ip); diff --git a/src/api-extban.c b/src/api-extban.c index dee3caed3..d1ec62dec 100644 --- a/src/api-extban.c +++ b/src/api-extban.c @@ -122,7 +122,7 @@ void ExtbanDel(Extban *eb) /** General is_ok for n!u@h stuff that also deals with recursive extbans. */ -int extban_is_ok_nuh_extban(Client* client, Channel* chptr, char* para, int checkt, int what, int what2) +int extban_is_ok_nuh_extban(Client* client, Channel* channel, char* para, int checkt, int what, int what2) { char *mask = (para + 3); Extban *p = NULL; @@ -135,7 +135,7 @@ int extban_is_ok_nuh_extban(Client* client, Channel* chptr, char* para, int chec if (extban_is_ok_recursion) return 0; /* Fail: more than one stacked extban */ - if ((checkt == EXBCHK_PARAM) && RESTRICT_EXTENDEDBANS && !ValidatePermissionsForPath("immune:restrict-extendedbans",client,NULL,chptr,NULL)) + if ((checkt == EXBCHK_PARAM) && RESTRICT_EXTENDEDBANS && !ValidatePermissionsForPath("immune:restrict-extendedbans",client,NULL,channel,NULL)) { /* Test if this specific extban has been disabled. * (We can be sure RESTRICT_EXTENDEDBANS is not *. Else this extended ban wouldn't be happening at all.) @@ -159,7 +159,7 @@ int extban_is_ok_nuh_extban(Client* client, Channel* chptr, char* para, int chec if (p->is_ok) { extban_is_ok_recursion++; - isok = p->is_ok(client, chptr, mask, checkt, what, what2); + isok = p->is_ok(client, channel, mask, checkt, what, what2); extban_is_ok_recursion--; return isok; } diff --git a/src/api-moddata.c b/src/api-moddata.c index d4555ccc6..0ec86e569 100644 --- a/src/api-moddata.c +++ b/src/api-moddata.c @@ -126,18 +126,18 @@ void moddata_free_local_client(Client *client) } // FIXME: this is never called -void moddata_free_channel(Channel *chptr) +void moddata_free_channel(Channel *channel) { ModDataInfo *md; for (md = MDInfo; md; md = md->next) if (md->type == MODDATATYPE_CHANNEL) { - if (md->free && moddata_channel(chptr, md).ptr) - md->free(&moddata_channel(chptr, md)); + if (md->free && moddata_channel(channel, md).ptr) + md->free(&moddata_channel(channel, md)); } - memset(chptr->moddata, 0, sizeof(chptr->moddata)); + memset(channel->moddata, 0, sizeof(channel->moddata)); } void moddata_free_member(Member *m) @@ -207,22 +207,22 @@ void unload_moddata_commit(ModDataInfo *md) } case MODDATATYPE_CHANNEL: { - Channel *chptr; - for (chptr = channels; chptr; chptr=chptr->nextch) + Channel *channel; + for (channel = channels; channel; channel=channel->nextch) { - if (md->free && moddata_channel(chptr, md).ptr) - md->free(&moddata_channel(chptr, md)); - memset(&moddata_channel(chptr, md), 0, sizeof(ModData)); + if (md->free && moddata_channel(channel, md).ptr) + md->free(&moddata_channel(channel, md)); + memset(&moddata_channel(channel, md), 0, sizeof(ModData)); } break; } case MODDATATYPE_MEMBER: { - Channel *chptr; + Channel *channel; Member *m; - for (chptr = channels; chptr; chptr=chptr->nextch) + for (channel = channels; channel; channel=channel->nextch) { - for (m = chptr->members; m; m = m->next) + for (m = channel->members; m; m = m->next) { if (md->free && moddata_member(m, md).ptr) md->free(&moddata_member(m, md)); diff --git a/src/channel.c b/src/channel.c index 9de668044..e3469345c 100644 --- a/src/channel.c +++ b/src/channel.c @@ -60,7 +60,7 @@ char cmodestring[512]; /* Some forward declarations */ char *clean_ban_mask(char *, int, Client *); -void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *chptr); +void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *channel); int sub1_from_channel(Channel *); void clean_channelname(char *); void del_invite(Client *, Channel *); @@ -121,7 +121,7 @@ Membership *find_membership_link(Membership *lp, Channel *ptr) if (ptr) while (lp) { - if (lp->chptr == ptr) + if (lp->channel == ptr) return (lp); lp = lp->next; } @@ -251,7 +251,7 @@ int identical_ban(char *one, char *two) * the specified channel. (Extended version with * set by nick and set on timestamp) */ -int add_listmode_ex(Ban **list, Client *client, Channel *chptr, char *banid, char *setby, time_t seton) +int add_listmode_ex(Ban **list, Client *client, Channel *channel, char *banid, char *setby, time_t seton) { Ban *ban; int cnt = 0, len; @@ -266,7 +266,7 @@ int add_listmode_ex(Ban **list, Client *client, Channel *chptr, char *banid, cha if (MyUser(client)) { /* Only send the error to local clients */ - sendnumeric(client, ERR_BANLISTFULL, chptr->chname, banid); + sendnumeric(client, ERR_BANLISTFULL, channel->chname, banid); } do_not_add = 1; } @@ -295,7 +295,7 @@ int add_listmode_ex(Ban **list, Client *client, Channel *chptr, char *banid, cha if (MyUser(client)) { /* Only send the error to local clients */ - sendnumeric(client, ERR_BANLISTFULL, chptr->chname, banid); + sendnumeric(client, ERR_BANLISTFULL, channel->chname, banid); } return -1; } @@ -322,7 +322,7 @@ int add_listmode_ex(Ban **list, Client *client, Channel *chptr, char *banid, cha /** Add a listmode (+beI) with the specified banid to * the specified channel. (Simplified version) */ -int add_listmode(Ban **list, Client *client, Channel *chptr, char *banid) +int add_listmode(Ban **list, Client *client, Channel *channel, char *banid) { char *setby = client->name; char nuhbuf[NICKLEN+USERLEN+HOSTLEN+4]; @@ -330,14 +330,14 @@ int add_listmode(Ban **list, Client *client, Channel *chptr, char *banid) if (IsUser(client) && (iConf.ban_setter == SETTER_NICK_USER_HOST)) setby = make_nick_user_host_r(nuhbuf, client->name, client->user->username, GetHost(client)); - return add_listmode_ex(list, client, chptr, banid, setby, TStime()); + return add_listmode_ex(list, client, channel, banid, setby, TStime()); } /* * del_listmode - delete a listmode (+beI) from a channel * that matches the specified banid. */ -int del_listmode(Ban **list, Channel *chptr, char *banid) +int del_listmode(Ban **list, Channel *channel, char *banid) { Ban **ban; Ban *tmp; @@ -366,7 +366,7 @@ int del_listmode(Ban **list, Channel *chptr, char *banid) /** is_banned - Check if a user is banned on a channel. * @param client Client to check (can be remote client) - * @param chptr Channel to check + * @param channel Channel to check * @param type Type of ban to check for (BANCHK_*) * @param msg Message, only for some BANCHK_* types, otherwise NULL * @param errmsg Error message returned, could be NULL (which does not @@ -374,14 +374,14 @@ int del_listmode(Ban **list, Channel *chptr, char *banid) * @returns A pointer to the ban struct if banned, otherwise NULL. * @comments Simple wrapper for is_banned_with_nick() */ -inline Ban *is_banned(Client *client, Channel *chptr, int type, char **msg, char **errmsg) +inline Ban *is_banned(Client *client, Channel *channel, int type, char **msg, char **errmsg) { - return is_banned_with_nick(client, chptr, type, NULL, msg, errmsg); + return is_banned_with_nick(client, channel, type, NULL, msg, errmsg); } /** ban_check_mask - Checks if the user matches the specified n!u@h mask -or- run an extended ban. * @param client Client to check (can be remote client) - * @param chptr Channel to check + * @param channel Channel to check * @param banstr Mask string to check user * @param type Type of ban to check for (BANCHK_*) * @param msg Message, only for some BANCHK_* types, otherwise NULL. @@ -391,7 +391,7 @@ inline Ban *is_banned(Client *client, Channel *chptr, int type, char **msg, char * @comments This is basically extracting the mask and extban check from is_banned_with_nick, but with being a bit more strict in what an extban is. * Strange things could happen if this is called outside standard ban checking. */ -inline int ban_check_mask(Client *client, Channel *chptr, char *banstr, int type, char **msg, char **errmsg, int no_extbans) +inline int ban_check_mask(Client *client, Channel *channel, char *banstr, int type, char **msg, char **errmsg, int no_extbans) { Extban *extban = NULL; if (!no_extbans && banstr[0] == '~' && banstr[1] != '\0' && banstr[2] == ':') @@ -404,7 +404,7 @@ inline int ban_check_mask(Client *client, Channel *chptr, char *banstr, int type } else { - return extban->is_banned(client, chptr, banstr, type, msg, errmsg); + return extban->is_banned(client, channel, banstr, type, msg, errmsg); } } else @@ -416,13 +416,13 @@ inline int ban_check_mask(Client *client, Channel *chptr, char *banstr, int type /** is_banned_with_nick - Check if a user is banned on a channel. * @param client Client to check (can be remote client) - * @param chptr Channel to check + * @param channel Channel to check * @param type Type of ban to check for (BANCHK_*) * @param nick Nick of the user (or NULL, to default to client->name) * @param msg Message, only for some BANCHK_* types, otherwise NULL * @returns A pointer to the ban struct if banned, otherwise NULL. */ -Ban *is_banned_with_nick(Client *client, Channel *chptr, int type, char *nick, char **msg, char **errmsg) +Ban *is_banned_with_nick(Client *client, Channel *channel, int type, char *nick, char **msg, char **errmsg) { Ban *ban, *ex; char savednick[NICKLEN+1]; @@ -448,18 +448,18 @@ Ban *is_banned_with_nick(Client *client, Channel *chptr, int type, char *nick, c * If a +e was found we return NULL, if not, we return the ban. */ - for (ban = chptr->banlist; ban; ban = ban->next) + for (ban = channel->banlist; ban; ban = ban->next) { - if (ban_check_mask(client, chptr, ban->banstr, type, msg, errmsg, 0)) + if (ban_check_mask(client, channel, ban->banstr, type, msg, errmsg, 0)) break; } if (ban) { /* Ban found, now check for +e */ - for (ex = chptr->exlist; ex; ex = ex->next) + for (ex = channel->exlist; ex; ex = ex->next) { - if (ban_check_mask(client, chptr, ex->banstr, type, msg, errmsg, 0)) + if (ban_check_mask(client, channel, ex->banstr, type, msg, errmsg, 0)) { /* except matched */ ban = NULL; @@ -482,7 +482,7 @@ Ban *is_banned_with_nick(Client *client, Channel *chptr, int type, char *nick, c * adds a user to a channel by adding another link to the channels member * chain. */ -void add_user_to_channel(Channel *chptr, Client *who, int flags) +void add_user_to_channel(Channel *channel, Client *who, int flags) { Member *m; Membership *mb; @@ -492,17 +492,17 @@ void add_user_to_channel(Channel *chptr, Client *who, int flags) m = make_member(); m->client = who; m->flags = flags; - m->next = chptr->members; - chptr->members = m; - chptr->users++; + m->next = channel->members; + channel->members = m; + channel->users++; mb = make_membership(); - mb->chptr = chptr; + mb->channel = channel; mb->next = who->user->channel; mb->flags = flags; who->user->channel = mb; who->user->joined++; - RunHook2(HOOKTYPE_JOIN_DATA,who,chptr); + RunHook2(HOOKTYPE_JOIN_DATA,who,channel); } } @@ -512,15 +512,15 @@ void add_user_to_channel(Channel *chptr, Client *who, int flags) * user was the last user (and the channel is not +P), * via sub1_from_channel(), that is. */ -int remove_user_from_channel(Client *client, Channel *chptr) +int remove_user_from_channel(Client *client, Channel *channel) { Member **m; Member *m2; Membership **mb; Membership *mb2; - /* Update chptr->members list */ - for (m = &chptr->members; (m2 = *m); m = &m2->next) + /* Update channel->members list */ + for (m = &channel->members; (m2 = *m); m = &m2->next) { if (m2->client == client) { @@ -533,7 +533,7 @@ int remove_user_from_channel(Client *client, Channel *chptr) /* Update client->user->channel list */ for (mb = &client->user->channel; (mb2 = *mb); mb = &mb2->next) { - if (mb2->chptr == chptr) + if (mb2->channel == channel) { *mb = mb2->next; free_membership(mb2); @@ -547,20 +547,20 @@ int remove_user_from_channel(Client *client, Channel *chptr) /* Now sub1_from_channel() will deal with the channel record * and destroy the channel if needed. */ - return sub1_from_channel(chptr); + return sub1_from_channel(channel); } -long get_access(Client *client, Channel *chptr) +long get_access(Client *client, Channel *channel) { Membership *lp; - if (chptr && IsUser(client)) - if ((lp = find_membership_link(client->user->channel, chptr))) + if (channel && IsUser(client)) + if ((lp = find_membership_link(client->user->channel, channel))) return lp->flags; return 0; } /** Returns 1 if channel has this channel mode set and 0 if not */ -int has_channel_mode(Channel *chptr, char mode) +int has_channel_mode(Channel *channel, char mode) { CoreChannelModeTable *tab = &corechannelmodetable[0]; int i; @@ -568,24 +568,24 @@ int has_channel_mode(Channel *chptr, char mode) /* Extended channel modes */ for (i=0; i <= Channelmode_highest; i++) { - if ((Channelmode_Table[i].flag == mode) && (chptr->mode.extmode & Channelmode_Table[i].mode)) + if ((Channelmode_Table[i].flag == mode) && (channel->mode.extmode & Channelmode_Table[i].mode)) return 1; } /* Built-in channel modes */ while (tab->mode != 0x0) { - if ((chptr->mode.mode & tab->mode) && (tab->flag == mode)) + if ((channel->mode.mode & tab->mode) && (tab->flag == mode)) return 1; tab++; } /* Special handling for +l (needed??) */ - if (chptr->mode.limit && (mode == 'l')) + if (channel->mode.limit && (mode == 'l')) return 1; /* Special handling for +k (needed??) */ - if (chptr->mode.key[0] && (mode == 'k')) + if (channel->mode.key[0] && (mode == 'k')) return 1; return 0; /* Not found */ @@ -616,11 +616,11 @@ long get_mode_bitbychar(char m) } /* - * write the "simple" list of channel modes for channel chptr onto buffer mbuf + * write the "simple" list of channel modes for channel channel onto buffer mbuf * with the parameters in pbuf. */ /* TODO: this function has many security issues and needs an audit, maybe even a recode */ -void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *chptr) +void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *channel) { CoreChannelModeTable *tab = &corechannelmodetable[0]; int ismember; @@ -628,7 +628,7 @@ void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, siz if (!(mbuf_size && pbuf_size)) return; - ismember = (IsMember(client, chptr) || IsServer(client) || IsMe(client) || IsULine(client)) ? 1 : 0; + ismember = (IsMember(client, channel) || IsServer(client) || IsMe(client) || IsULine(client)) ? 1 : 0; *pbuf = '\0'; @@ -637,7 +637,7 @@ void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, siz /* Paramless first */ while (mbuf_size && tab->mode != 0x0) { - if ((chptr->mode.mode & tab->mode)) + if ((channel->mode.mode & tab->mode)) if (!tab->parameters) { *mbuf++ = tab->flag; mbuf_size--; @@ -648,31 +648,31 @@ void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, siz { if (!mbuf_size) break; if (Channelmode_Table[i].flag && !Channelmode_Table[i].paracount && - (chptr->mode.extmode & Channelmode_Table[i].mode)) { + (channel->mode.extmode & Channelmode_Table[i].mode)) { *mbuf++ = Channelmode_Table[i].flag; mbuf_size--; } } - if (chptr->mode.limit) + if (channel->mode.limit) { if (mbuf_size) { *mbuf++ = 'l'; mbuf_size--; } if (ismember) { - ircsnprintf(pbuf, pbuf_size, "%d ", chptr->mode.limit); + ircsnprintf(pbuf, pbuf_size, "%d ", channel->mode.limit); pbuf_size-=strlen(pbuf); pbuf+=strlen(pbuf); } } - if (*chptr->mode.key) + if (*channel->mode.key) { if (mbuf_size) { *mbuf++ = 'k'; mbuf_size--; } if (ismember && pbuf_size) { - ircsnprintf(pbuf, pbuf_size, "%s ", chptr->mode.key); + ircsnprintf(pbuf, pbuf_size, "%s ", channel->mode.key); pbuf_size-=strlen(pbuf); pbuf+=strlen(pbuf); } @@ -681,7 +681,7 @@ void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, siz for (i=0; i <= Channelmode_highest; i++) { if (Channelmode_Table[i].flag && Channelmode_Table[i].paracount && - (chptr->mode.extmode & Channelmode_Table[i].mode)) { + (channel->mode.extmode & Channelmode_Table[i].mode)) { char flag = Channelmode_Table[i].flag; if (mbuf_size) { *mbuf++ = flag; @@ -689,7 +689,7 @@ void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, siz } if (ismember) { - ircsnprintf(pbuf, pbuf_size, "%s ", cm_getparameter(chptr, flag)); + ircsnprintf(pbuf, pbuf_size, "%s ", cm_getparameter(channel, flag)); pbuf_size-=strlen(pbuf); pbuf+=strlen(pbuf); } @@ -851,12 +851,12 @@ char *clean_ban_mask(char *mask, int what, Client *client) trim_str(host,HOSTLEN)); } -int find_invex(Channel *chptr, Client *client) +int find_invex(Channel *channel, Client *client) { Ban *inv; - for (inv = chptr->invexlist; inv; inv = inv->next) - if (ban_check_mask(client, chptr, inv->banstr, BANCHK_JOIN, NULL, NULL, 0)) + for (inv = channel->invexlist; inv; inv = inv->next) + if (ban_check_mask(client, channel, inv->banstr, BANCHK_JOIN, NULL, NULL, 0)) return 1; return 0; @@ -922,7 +922,7 @@ void clean_channelname(char *cname) */ Channel *get_channel(Client *client, char *chname, int flag) { - Channel *chptr; + Channel *channel; int len; if (BadPtr(chname)) @@ -934,25 +934,25 @@ Channel *get_channel(Client *client, char *chname, int flag) len = CHANNELLEN; *(chname + CHANNELLEN) = '\0'; } - if ((chptr = find_channel(chname, NULL))) - return (chptr); + if ((channel = find_channel(chname, NULL))) + return (channel); if (flag == CREATE) { - chptr = safe_alloc(sizeof(Channel) + len); - strlcpy(chptr->chname, chname, len + 1); + channel = safe_alloc(sizeof(Channel) + len); + strlcpy(channel->chname, chname, len + 1); if (channels) - channels->prevch = chptr; - chptr->topic = NULL; - chptr->topic_nick = NULL; - chptr->prevch = NULL; - chptr->nextch = channels; - chptr->creationtime = MyUser(client) ? TStime() : 0; - channels = chptr; - (void)add_to_channel_hash_table(chname, chptr); + channels->prevch = channel; + channel->topic = NULL; + channel->topic_nick = NULL; + channel->prevch = NULL; + channel->nextch = channels; + channel->creationtime = MyUser(client) ? TStime() : 0; + channels = channel; + (void)add_to_channel_hash_table(chname, channel); irccounts.channels++; - RunHook2(HOOKTYPE_CHANNEL_CREATE, client, chptr); + RunHook2(HOOKTYPE_CHANNEL_CREATE, client, channel); } - return chptr; + return channel; } /* @@ -963,11 +963,11 @@ Channel *get_channel(Client *client, char *chname, int flag) * Should U-lined clients have higher limits? -Donwulff */ -void add_invite(Client *from, Client *to, Channel *chptr, MessageTag *mtags) +void add_invite(Client *from, Client *to, Channel *channel, MessageTag *mtags) { Link *inv, *tmp; - del_invite(to, chptr); + del_invite(to, channel); /* * delete last link in chain if the list is max length */ @@ -975,45 +975,45 @@ void add_invite(Client *from, Client *to, Channel *chptr, MessageTag *mtags) { for (tmp = to->user->invited; tmp->next; tmp = tmp->next) ; - del_invite(to, tmp->value.chptr); + del_invite(to, tmp->value.channel); } /* We get pissy over too many invites per channel as well now, * since otherwise mass-inviters could take up some major * resources -Donwulff */ - if (list_length(chptr->invites) >= MAXCHANNELSPERUSER) + if (list_length(channel->invites) >= MAXCHANNELSPERUSER) { - for (tmp = chptr->invites; tmp->next; tmp = tmp->next) + for (tmp = channel->invites; tmp->next; tmp = tmp->next) ; - del_invite(tmp->value.client, chptr); + del_invite(tmp->value.client, channel); } /* * add client to the beginning of the channel invite list */ inv = make_link(); inv->value.client = to; - inv->next = chptr->invites; - chptr->invites = inv; + inv->next = channel->invites; + channel->invites = inv; /* * add channel to the beginning of the client invite list */ inv = make_link(); - inv->value.chptr = chptr; + inv->value.channel = channel; inv->next = to->user->invited; to->user->invited = inv; - RunHook4(HOOKTYPE_INVITE, from, to, chptr, mtags); + RunHook4(HOOKTYPE_INVITE, from, to, channel, mtags); } /* * Delete Invite block from channel invite list and client invite list */ -void del_invite(Client *client, Channel *chptr) +void del_invite(Client *client, Channel *channel) { Link **inv, *tmp; - for (inv = &(chptr->invites); (tmp = *inv); inv = &tmp->next) + for (inv = &(channel->invites); (tmp = *inv); inv = &tmp->next) if (tmp->value.client == client) { *inv = tmp->next; @@ -1022,7 +1022,7 @@ void del_invite(Client *client, Channel *chptr) } for (inv = &(client->user->invited); (tmp = *inv); inv = &tmp->next) - if (tmp->value.chptr == chptr) + if (tmp->value.channel == channel) { *inv = tmp->next; free_link(tmp); @@ -1031,24 +1031,24 @@ void del_invite(Client *client, Channel *chptr) } /** Subtract one user from channel i. Free the channel if it became empty. - * @param chptr The channel + * @param channel The channel * @returns 1 if the channel was freed, 0 if the channel still exists. */ -int sub1_from_channel(Channel *chptr) +int sub1_from_channel(Channel *channel) { Ban *ban; Link *lp; int should_destroy = 1; - --chptr->users; - if (chptr->users > 0) + --channel->users; + if (channel->users > 0) return 0; /* No users in the channel anymore */ - chptr->users = 0; /* to be sure */ + channel->users = 0; /* to be sure */ /* If the channel is +P then this hook will actually stop destruction. */ - RunHook2(HOOKTYPE_CHANNEL_DESTROY, chptr, &should_destroy); + RunHook2(HOOKTYPE_CHANNEL_DESTROY, channel, &should_destroy); if (!should_destroy) return 0; @@ -1056,52 +1056,52 @@ int sub1_from_channel(Channel *chptr) * But first we will destroy all kinds of references and lists... */ - while ((lp = chptr->invites)) - del_invite(lp->value.client, chptr); + while ((lp = channel->invites)) + del_invite(lp->value.client, channel); - while (chptr->banlist) + while (channel->banlist) { - ban = chptr->banlist; - chptr->banlist = ban->next; + ban = channel->banlist; + channel->banlist = ban->next; safe_free(ban->banstr); safe_free(ban->who); free_ban(ban); } - while (chptr->exlist) + while (channel->exlist) { - ban = chptr->exlist; - chptr->exlist = ban->next; + ban = channel->exlist; + channel->exlist = ban->next; safe_free(ban->banstr); safe_free(ban->who); free_ban(ban); } - while (chptr->invexlist) + while (channel->invexlist) { - ban = chptr->invexlist; - chptr->invexlist = ban->next; + ban = channel->invexlist; + channel->invexlist = ban->next; safe_free(ban->banstr); safe_free(ban->who); free_ban(ban); } /* free extcmode params */ - extcmode_free_paramlist(chptr->mode.extmodeparams); + extcmode_free_paramlist(channel->mode.extmodeparams); - safe_free(chptr->mode_lock); - safe_free(chptr->topic); - safe_free(chptr->topic_nick); + safe_free(channel->mode_lock); + safe_free(channel->topic); + safe_free(channel->topic_nick); - if (chptr->prevch) - chptr->prevch->nextch = chptr->nextch; + if (channel->prevch) + channel->prevch->nextch = channel->nextch; else - channels = chptr->nextch; + channels = channel->nextch; - if (chptr->nextch) - chptr->nextch->prevch = chptr->prevch; - (void)del_from_channel_hash_table(chptr->chname, chptr); + if (channel->nextch) + channel->nextch->prevch = channel->prevch; + (void)del_from_channel_hash_table(channel->chname, channel); irccounts.channels--; - safe_free(chptr); + safe_free(channel); return 1; } @@ -1110,7 +1110,7 @@ int sub1_from_channel(Channel *chptr) void send_user_joins(Client *client, Client *user) { Membership *lp; - Channel *chptr; + Channel *channel; int cnt = 0, len = 0, clen; char *mask; @@ -1119,13 +1119,13 @@ void send_user_joins(Client *client, Client *user) for (lp = user->user->channel; lp; lp = lp->next) { - chptr = lp->chptr; - if ((mask = strchr(chptr->chname, ':'))) + channel = lp->channel; + if ((mask = strchr(channel->chname, ':'))) if (!match_simple(++mask, client->name)) continue; - if (*chptr->chname == '&') + if (*channel->chname == '&') continue; - clen = strlen(chptr->chname); + clen = strlen(channel->chname); if (clen + 1 + len > BUFSIZE - 3) { if (cnt) @@ -1137,7 +1137,7 @@ void send_user_joins(Client *client, Client *user) len = strlen(buf); cnt = 0; } - (void)strlcpy(buf + len, chptr->chname, sizeof buf-len); + (void)strlcpy(buf + len, channel->chname, sizeof buf-len); cnt++; len += clen; if (lp->next) @@ -1158,15 +1158,15 @@ void send_user_joins(Client *client, Client *user) * output - * side effects - channel mlock is changed / MLOCK is propagated */ -void set_channel_mlock(Client *client, Channel *chptr, const char *newmlock, int propagate) +void set_channel_mlock(Client *client, Channel *channel, const char *newmlock, int propagate) { - safe_strdup(chptr->mode_lock, newmlock); + safe_strdup(channel->mode_lock, newmlock); if (propagate) { sendto_server(client, 0, 0, NULL, ":%s MLOCK %lld %s :%s", - client->name, (long long)chptr->creationtime, chptr->chname, - BadPtr(chptr->mode_lock) ? "" : chptr->mode_lock); + client->name, (long long)channel->creationtime, channel->chname, + BadPtr(channel->mode_lock) ? "" : channel->mode_lock); } } @@ -1313,7 +1313,7 @@ int has_common_channels(Client *c1, Client *c2) for (lp = c1->user->channel; lp; lp = lp->next) { - if (IsMember(c2, lp->chptr) && user_can_see_member(c1, c2, lp->chptr)) + if (IsMember(c2, lp->channel) && user_can_see_member(c1, c2, lp->channel)) return 1; } return 0; @@ -1323,7 +1323,7 @@ int has_common_channels(Client *c1, Client *c2) * This may return 0 if the user is 'invisible' due to mode +D rules. * NOTE: Membership is unchecked, assumed membership of both. */ -int user_can_see_member(Client *user, Client *target, Channel *chptr) +int user_can_see_member(Client *user, Client *target, Channel *channel) { Hook *h; int j = 0; @@ -1333,35 +1333,35 @@ int user_can_see_member(Client *user, Client *target, Channel *chptr) for (h = Hooks[HOOKTYPE_VISIBLE_IN_CHANNEL]; h; h = h->next) { - j = (*(h->func.intfunc))(target,chptr); + j = (*(h->func.intfunc))(target,channel); if (j != 0) break; } /* We must ensure that user is allowed to "see" target */ - if (j != 0 && !(is_skochanop(target, chptr) || has_voice(target,chptr)) && !is_skochanop(user, chptr)) + if (j != 0 && !(is_skochanop(target, channel) || has_voice(target,channel)) && !is_skochanop(user, channel)) return 0; return 1; } -/** Returns 1 if user 'target' is invisible in channel 'chptr'. +/** Returns 1 if user 'target' is invisible in channel 'channel'. * This may return 0 if the user is 'invisible' due to mode +D rules. */ -int invisible_user_in_channel(Client *target, Channel *chptr) +int invisible_user_in_channel(Client *target, Channel *channel) { Hook *h; int j = 0; for (h = Hooks[HOOKTYPE_VISIBLE_IN_CHANNEL]; h; h = h->next) { - j = (*(h->func.intfunc))(target,chptr); + j = (*(h->func.intfunc))(target,channel); if (j != 0) break; } /* We must ensure that user is allowed to "see" target */ - if (j != 0 && !(is_skochanop(target, chptr) || has_voice(target,chptr))) + if (j != 0 && !(is_skochanop(target, channel) || has_voice(target,channel))) return 1; return 0; diff --git a/src/hash.c b/src/hash.c index 5bf8e84df..d107114f2 100644 --- a/src/hash.c +++ b/src/hash.c @@ -360,13 +360,13 @@ int add_to_id_hash_table(char *name, Client *client) /* * add_to_channel_hash_table */ -int add_to_channel_hash_table(char *name, Channel *chptr) +int add_to_channel_hash_table(char *name, Channel *channel) { unsigned int hashv; hashv = hash_channel_name(name); - chptr->hnextch = channelTable[hashv]; - channelTable[hashv] = chptr; + channel->hnextch = channelTable[hashv]; + channelTable[hashv] = channel; return 0; } /* @@ -395,7 +395,7 @@ int del_from_id_hash_table(char *name, Client *client) /* * del_from_channel_hash_table */ -void del_from_channel_hash_table(char *name, Channel *chptr) +void del_from_channel_hash_table(char *name, Channel *channel) { Channel *tmp, *prev = NULL; unsigned int hashv; @@ -403,7 +403,7 @@ void del_from_channel_hash_table(char *name, Channel *chptr) hashv = hash_channel_name(name); for (tmp = channelTable[hashv]; tmp; tmp = tmp->hnextch) { - if (tmp == chptr) + if (tmp == channel) { if (prev) prev->hnextch = tmp->hnextch; @@ -561,7 +561,7 @@ Client *find_person(char *name, Client *requester) /* * hash_find_channel */ -Channel *hash_find_channel(char *name, Channel *chptr) +Channel *hash_find_channel(char *name, Channel *channel) { unsigned int hashv; Channel *tmp; @@ -573,7 +573,7 @@ Channel *hash_find_channel(char *name, Channel *chptr) if (smycmp(name, tmp->chname) == 0) return tmp; } - return chptr; + return channel; } Channel *hash_get_chan_bucket(uint64_t hashv) diff --git a/src/misc.c b/src/misc.c index cd6047edb..718d18a1a 100644 --- a/src/misc.c +++ b/src/misc.c @@ -473,11 +473,11 @@ static void exit_one_client(Client *client, MessageTag *mtags_i, const char *com free_message_tags(mtags_o); while ((mp = client->user->channel)) - remove_user_from_channel(client, mp->chptr); + remove_user_from_channel(client, mp->channel); /* Clean up invitefield */ while ((lp = client->user->invited)) - del_invite(client, lp->value.chptr); + del_invite(client, lp->value.channel); /* again, this is all that is needed */ /* Clean up dccallow list and (if needed) notify other clients diff --git a/src/modules/chanmodes/censor.c b/src/modules/chanmodes/censor.c index a8a019794..6afaaa51e 100644 --- a/src/modules/chanmodes/censor.c +++ b/src/modules/chanmodes/censor.c @@ -20,8 +20,8 @@ Cmode_t EXTMODE_CENSOR = 0L; #define IsCensored(x) ((x)->mode.extmode & EXTMODE_CENSOR) -char *censor_pre_chanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice); -char *censor_pre_local_part(Client *client, Channel *chptr, char *text); +char *censor_pre_chanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice); +char *censor_pre_local_part(Client *client, Channel *channel, char *text); char *censor_pre_local_quit(Client *client, char *text); int censor_config_test(ConfigFile *, ConfigEntry *, int, int *); @@ -253,18 +253,18 @@ char *stripbadwords_channel(char *str, int *blocked) return stripbadwords(str, conf_badword_channel, blocked); } -char *censor_pre_chanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice) +char *censor_pre_chanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice) { int blocked; Hook *h; int i; - if (!IsCensored(chptr)) + if (!IsCensored(channel)) return text; for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, BYPASS_CHANMSG_CENSOR); + i = (*(h->func.intfunc))(client, channel, BYPASS_CHANMSG_CENSOR); if (i == HOOK_ALLOW) return text; /* bypass */ if (i != HOOK_CONTINUE) @@ -275,22 +275,22 @@ char *censor_pre_chanmsg(Client *client, Channel *chptr, MessageTag *mtags, char if (blocked) { if (!notice) - sendnumeric(client, ERR_CANNOTSENDTOCHAN, chptr->chname, - "Swearing is not permitted in this channel", chptr->chname); + sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->chname, + "Swearing is not permitted in this channel", channel->chname); return NULL; } return text; } -char *censor_pre_local_part(Client *client, Channel *chptr, char *text) +char *censor_pre_local_part(Client *client, Channel *channel, char *text) { int blocked; if (!text) return NULL; - if (!IsCensored(chptr)) + if (!IsCensored(channel)) return text; text = stripbadwords_channel(text, &blocked); @@ -303,7 +303,7 @@ static int IsAnyChannelCensored(Client *client) Membership *lp; for (lp = client->user->channel; lp; lp = lp->next) - if (IsCensored(lp->chptr)) + if (IsCensored(lp->channel)) return 1; return 0; } diff --git a/src/modules/chanmodes/delayjoin.c b/src/modules/chanmodes/delayjoin.c index a4743859d..af094f6ee 100644 --- a/src/modules/chanmodes/delayjoin.c +++ b/src/modules/chanmodes/delayjoin.c @@ -23,14 +23,14 @@ static Cmode *CmodePostDelayed = NULL; static Cmode_t EXTMODE_DELAYED; static Cmode_t EXTMODE_POST_DELAYED; -int visible_in_channel(Client *client, Channel *chptr); -int moded_check_part(Client *client, Channel *chptr); -int moded_join(Client *client, Channel *chptr); -int moded_part(Client *client, Channel *chptr, MessageTag *mtags, char *comment); -int deny_all(Client *client, Channel *chptr, char mode, char *para, int checkt, int what); -int moded_chanmode(Client *client, Channel *chptr, +int visible_in_channel(Client *client, Channel *channel); +int moded_check_part(Client *client, Channel *channel); +int moded_join(Client *client, Channel *channel); +int moded_part(Client *client, Channel *channel, MessageTag *mtags, char *comment); +int deny_all(Client *client, Channel *channel, char mode, char *para, int checkt, int what); +int moded_chanmode(Client *client, Channel *channel, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); -char *moded_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice); +char *moded_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice); char *moded_serialize(ModData *m); void moded_unserialize(char *str, ModData *m); @@ -93,29 +93,29 @@ MOD_UNLOAD() return MOD_SUCCESS; } -void set_post_delayed(Channel *chptr) +void set_post_delayed(Channel *channel) { MessageTag *mtags = NULL; - chptr->mode.extmode |= EXTMODE_POST_DELAYED; + channel->mode.extmode |= EXTMODE_POST_DELAYED; new_message(&me, NULL, &mtags); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +d", me.name, chptr->chname); + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +d", me.name, channel->chname); free_message_tags(mtags); } -void clear_post_delayed(Channel *chptr) +void clear_post_delayed(Channel *channel) { MessageTag *mtags = NULL; - chptr->mode.extmode &= ~EXTMODE_POST_DELAYED; + channel->mode.extmode &= ~EXTMODE_POST_DELAYED; new_message(&me, NULL, &mtags); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -d", me.name, chptr->chname); + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -d", me.name, channel->chname); free_message_tags(mtags); } -bool moded_member_invisible(Member* m, Channel *chptr) +bool moded_member_invisible(Member* m, Channel *channel) { ModDataInfo *md; @@ -133,17 +133,17 @@ bool moded_member_invisible(Member* m, Channel *chptr) } -bool moded_user_invisible(Client *client, Channel *chptr) +bool moded_user_invisible(Client *client, Channel *channel) { - return moded_member_invisible(find_member_link(chptr->members, client), chptr); + return moded_member_invisible(find_member_link(channel->members, client), channel); } -bool channel_has_invisible_users(Channel *chptr) +bool channel_has_invisible_users(Channel *channel) { Member* i; - for (i = chptr->members; i; i = i->next) + for (i = channel->members; i; i = i->next) { - if (moded_member_invisible(i, chptr)) + if (moded_member_invisible(i, channel)) { return true; } @@ -151,21 +151,21 @@ bool channel_has_invisible_users(Channel *chptr) return false; } -bool channel_is_post_delayed(Channel *chptr) +bool channel_is_post_delayed(Channel *channel) { - if (chptr->mode.extmode & EXTMODE_POST_DELAYED) + if (channel->mode.extmode & EXTMODE_POST_DELAYED) return true; return false; } -bool channel_is_delayed(Channel *chptr) +bool channel_is_delayed(Channel *channel) { - if (chptr->mode.extmode & EXTMODE_DELAYED) + if (channel->mode.extmode & EXTMODE_DELAYED) return true; return false; } -void clear_user_invisible(Channel *chptr, Client *client) +void clear_user_invisible(Channel *channel, Client *client) { Member *i; ModDataInfo *md; @@ -174,7 +174,7 @@ void clear_user_invisible(Channel *chptr, Client *client) md = findmoddata_byname(MOD_DATA_STR, MODDATATYPE_MEMBER); if (!md) return; - for (i = chptr->members; i; i = i->next) + for (i = channel->members; i; i = i->next) { if (i->client == client) { @@ -196,13 +196,13 @@ void clear_user_invisible(Channel *chptr, Client *client) } } - if (should_clear && (chptr->mode.extmode & EXTMODE_POST_DELAYED)) + if (should_clear && (channel->mode.extmode & EXTMODE_POST_DELAYED)) { - clear_post_delayed(chptr); + clear_post_delayed(channel); } } -void clear_user_invisible_announce(Channel *chptr, Client *client, MessageTag *recv_mtags) +void clear_user_invisible_announce(Channel *channel, Client *client, MessageTag *recv_mtags) { Member *i; MessageTag *mtags = NULL; @@ -210,21 +210,21 @@ void clear_user_invisible_announce(Channel *chptr, Client *client, MessageTag *r char exjoinbuf[512]; long CAP_EXTENDED_JOIN = ClientCapabilityBit("extended-join"); - clear_user_invisible(chptr, client); + clear_user_invisible(channel, client); ircsnprintf(joinbuf, sizeof(joinbuf), ":%s!%s@%s JOIN %s", - client->name, client->user->username, GetHost(client), chptr->chname); + client->name, client->user->username, GetHost(client), channel->chname); ircsnprintf(exjoinbuf, sizeof(exjoinbuf), ":%s!%s@%s JOIN %s %s :%s", - client->name, client->user->username, GetHost(client), chptr->chname, + client->name, client->user->username, GetHost(client), channel->chname, !isdigit(*client->user->svid) ? client->user->svid : "*", client->info); - new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, chptr->chname); - for (i = chptr->members; i; i = i->next) + new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->chname); + for (i = channel->members; i; i = i->next) { Client *acptr = i->client; - if (!is_skochanop(acptr, chptr) && acptr != client && MyConnect(acptr)) + if (!is_skochanop(acptr, channel) && acptr != client && MyConnect(acptr)) { if (HasCapabilityFast(acptr, CAP_EXTENDED_JOIN)) sendto_one(acptr, mtags, "%s", exjoinbuf); @@ -235,9 +235,9 @@ void clear_user_invisible_announce(Channel *chptr, Client *client, MessageTag *r free_message_tags(mtags); } -void set_user_invisible(Channel *chptr, Client *client) +void set_user_invisible(Channel *channel, Client *client) { - Member *m = find_member_link(chptr->members, client); + Member *m = find_member_link(channel->members, client); ModDataInfo *md; if (!m) @@ -252,45 +252,45 @@ void set_user_invisible(Channel *chptr, Client *client) } -int deny_all(Client *client, Channel *chptr, char mode, char *para, int checkt, int what) +int deny_all(Client *client, Channel *channel, char mode, char *para, int checkt, int what) { return EX_ALWAYS_DENY; } -int visible_in_channel(Client *client, Channel *chptr) +int visible_in_channel(Client *client, Channel *channel) { - return channel_is_delayed(chptr) && moded_user_invisible(client, chptr); + return channel_is_delayed(channel) && moded_user_invisible(client, channel); } -int moded_join(Client *client, Channel *chptr) +int moded_join(Client *client, Channel *channel) { - if (channel_is_delayed(chptr)) - set_user_invisible(chptr, client); + if (channel_is_delayed(channel)) + set_user_invisible(channel, client); return 0; } -int moded_part(Client *client, Channel *chptr, MessageTag *mtags, char *comment) +int moded_part(Client *client, Channel *channel, MessageTag *mtags, char *comment) { - if (channel_is_delayed(chptr) || channel_is_post_delayed(chptr)) - clear_user_invisible(chptr, client); + if (channel_is_delayed(channel) || channel_is_post_delayed(channel)) + clear_user_invisible(channel, client); return 0; } -int moded_chanmode(Client *client, Channel *chptr, MessageTag *recv_mtags, char *modebuf, char *parabuf, time_t sendts, int samode) +int moded_chanmode(Client *client, Channel *channel, MessageTag *recv_mtags, char *modebuf, char *parabuf, time_t sendts, int samode) { long CAP_EXTENDED_JOIN = ClientCapabilityBit("extended-join"); // Handle case where we just unset +D but have invisible users - if (!channel_is_delayed(chptr) && !channel_is_post_delayed(chptr) && channel_has_invisible_users(chptr)) - set_post_delayed(chptr); - else if (channel_is_delayed(chptr) && channel_is_post_delayed(chptr)) - clear_post_delayed(chptr); + if (!channel_is_delayed(channel) && !channel_is_post_delayed(channel) && channel_has_invisible_users(channel)) + set_post_delayed(channel); + else if (channel_is_delayed(channel) && channel_is_post_delayed(channel)) + clear_post_delayed(channel); - if ((channel_is_delayed(chptr) || channel_is_post_delayed(chptr))) + if ((channel_is_delayed(channel) || channel_is_post_delayed(channel))) { ParseMode pm; int ret; @@ -303,30 +303,30 @@ int moded_chanmode(Client *client, Channel *chptr, MessageTag *recv_mtags, char if (!user) continue; - if (moded_user_invisible(user, chptr)) - clear_user_invisible_announce(chptr, user, recv_mtags); + if (moded_user_invisible(user, channel)) + clear_user_invisible_announce(channel, user, recv_mtags); if (pm.modechar == 'v' || !MyConnect(user)) continue; /* Our user 'user' just got ops (oaq) - send the joins for all the users (s)he doesn't know about */ - for (i = chptr->members; i; i = i->next) + for (i = channel->members; i; i = i->next) { if (i->client == user) continue; - if (moded_user_invisible(i->client, chptr)) + if (moded_user_invisible(i->client, channel)) { MessageTag *mtags = NULL; - new_message_special(i->client, recv_mtags, &mtags, ":%s JOIN %s", i->client->name, chptr->chname); + new_message_special(i->client, recv_mtags, &mtags, ":%s JOIN %s", i->client->name, channel->chname); if (HasCapabilityFast(user, CAP_EXTENDED_JOIN)) { sendto_one(user, mtags, ":%s!%s@%s JOIN %s %s :%s", i->client->name, i->client->user->username, GetHost(i->client), - chptr->chname, + channel->chname, !isdigit(*i->client->user->svid) ? i->client->user->svid : "*", i->client->info); } else { - sendto_one(user, mtags, ":%s!%s@%s JOIN :%s", i->client->name, i->client->user->username, GetHost(i->client), chptr->chname); + sendto_one(user, mtags, ":%s!%s@%s JOIN :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->chname); } free_message_tags(mtags); } @@ -340,22 +340,22 @@ int moded_chanmode(Client *client, Channel *chptr, MessageTag *recv_mtags, char if (!user) continue; - if (moded_user_invisible(user, chptr)) - clear_user_invisible_announce(chptr, user, recv_mtags); + if (moded_user_invisible(user, channel)) + clear_user_invisible_announce(channel, user, recv_mtags); if (pm.modechar == 'v' || !MyConnect(user)) continue; /* Our user 'user' just lost ops (oaq) - send the parts for all users (s)he won't see anymore */ - for (i = chptr->members; i; i = i->next) + for (i = channel->members; i; i = i->next) { if (i->client == user) continue; - if (moded_user_invisible(i->client, chptr)) + if (moded_user_invisible(i->client, channel)) { MessageTag *mtags = NULL; - new_message_special(i->client, recv_mtags, &mtags, ":%s PART %s", i->client->name, chptr->chname); - sendto_one(user, mtags, ":%s!%s@%s PART :%s", i->client->name, i->client->user->username, GetHost(i->client), chptr->chname); + new_message_special(i->client, recv_mtags, &mtags, ":%s PART %s", i->client->name, channel->chname); + sendto_one(user, mtags, ":%s!%s@%s PART :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->chname); free_message_tags(mtags); } } @@ -367,11 +367,11 @@ int moded_chanmode(Client *client, Channel *chptr, MessageTag *recv_mtags, char return 0; } -char *moded_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice) +char *moded_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice) { - if ((channel_is_delayed(chptr) || channel_is_post_delayed(chptr)) && (moded_user_invisible(client, chptr))) - clear_user_invisible_announce(chptr, client, mtags); + if ((channel_is_delayed(channel) || channel_is_post_delayed(channel)) && (moded_user_invisible(client, channel))) + clear_user_invisible_announce(channel, client, mtags); return text; } diff --git a/src/modules/chanmodes/floodprot.c b/src/modules/chanmodes/floodprot.c index 2b1701619..cf0d284f9 100644 --- a/src/modules/chanmodes/floodprot.c +++ b/src/modules/chanmodes/floodprot.c @@ -54,7 +54,7 @@ typedef struct RemoveChannelModeTimer RemoveChannelModeTimer; struct RemoveChannelModeTimer { struct RemoveChannelModeTimer *prev, *next; - Channel *chptr; + Channel *channel; char m; /* mode to be removed */ time_t when; /* scheduled at */ }; @@ -98,32 +98,32 @@ static void init_config(void); int floodprot_rehash_complete(void); int floodprot_config_test(ConfigFile *, ConfigEntry *, int, int *); int floodprot_config_run(ConfigFile *, ConfigEntry *, int); -void floodprottimer_del(Channel *chptr, char mflag); -void floodprottimer_stopchantimers(Channel *chptr); +void floodprottimer_del(Channel *channel, char mflag); +void floodprottimer_stopchantimers(Channel *channel); static inline char *chmodefstrhelper(char *buf, char t, char tdef, unsigned short l, unsigned char a, unsigned char r); static int compare_floodprot_modes(ChannelFloodProtection *a, ChannelFloodProtection *b); -static int do_floodprot(Channel *chptr, int what); +static int do_floodprot(Channel *channel, int what); char *channel_modef_string(ChannelFloodProtection *x, char *str); -int check_for_chan_flood(Client *client, Channel *chptr, char *text); -void do_floodprot_action(Channel *chptr, int what, char *text); -void floodprottimer_add(Channel *chptr, char mflag, time_t when); +int check_for_chan_flood(Client *client, Channel *channel, char *text); +void do_floodprot_action(Channel *channel, int what, char *text); +void floodprottimer_add(Channel *channel, char mflag, time_t when); uint64_t gen_floodprot_msghash(char *text); -int cmodef_is_ok(Client *client, Channel *chptr, char mode, char *para, int type, int what); +int cmodef_is_ok(Client *client, Channel *channel, char mode, char *para, int type, int what); void *cmodef_put_param(void *r_in, char *param); char *cmodef_get_param(void *r_in); char *cmodef_conv_param(char *param_in, Client *client); void cmodef_free_param(void *r); void *cmodef_dup_struct(void *r_in); -int cmodef_sjoin_check(Channel *chptr, void *ourx, void *theirx); -int floodprot_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]); +int cmodef_sjoin_check(Channel *channel, void *ourx, void *theirx); +int floodprot_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]); EVENT(modef_event); -int cmodef_channel_destroy(Channel *chptr, int *should_destroy); -char *floodprot_pre_chanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice); -int floodprot_post_chanmsg(Client *client, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice); -int floodprot_knock(Client *client, Channel *chptr, MessageTag *mtags, char *comment); +int cmodef_channel_destroy(Channel *channel, int *should_destroy); +char *floodprot_pre_chanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice); +int floodprot_post_chanmsg(Client *client, Channel *channel, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice); +int floodprot_knock(Client *client, Channel *channel, MessageTag *mtags, char *comment); int floodprot_local_nickchange(Client *client, char *oldnick); int floodprot_remote_nickchange(Client *client, char *oldnick); -int floodprot_chanmode_del(Channel *chptr, int m); +int floodprot_chanmode_del(Channel *channel, int m); void memberflood_free(ModData *md); int floodprot_stats(Client *client, char *flag); void floodprot_free_removechannelmodetimer_list(ModData *m); @@ -300,11 +300,11 @@ int floodprot_config_run(ConfigFile *cf, ConfigEntry *ce, int type) return 1; } -int cmodef_is_ok(Client *client, Channel *chptr, char mode, char *param, int type, int what) +int cmodef_is_ok(Client *client, Channel *channel, char mode, char *param, int type, int what) { if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR)) { - if (IsUser(client) && is_chan_op(client, chptr)) + if (IsUser(client) && is_chan_op(client, channel)) return EX_ALLOW; if (type == EXCHK_ACCESS_ERR) /* can only be due to being halfop */ sendnumeric(client, ERR_NOTFORHALFOPS, 'f'); @@ -829,7 +829,7 @@ void *cmodef_dup_struct(void *r_in) return (void *)w; } -int cmodef_sjoin_check(Channel *chptr, void *ourx, void *theirx) +int cmodef_sjoin_check(Channel *channel, void *ourx, void *theirx) { ChannelFloodProtection *our = (ChannelFloodProtection *)ourx; ChannelFloodProtection *their = (ChannelFloodProtection *)theirx; @@ -849,7 +849,7 @@ int cmodef_sjoin_check(Channel *chptr, void *ourx, void *theirx) return EXSJ_MERGE; } -int floodprot_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]) +int floodprot_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]) { /* I'll explain this only once: * 1. if channel is +f @@ -861,14 +861,14 @@ int floodprot_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv * Nr 6 is done because otherwise you would have a noticeflood with 'joinflood detected' * from all servers. */ - if (IsFloodLimit(chptr) && + if (IsFloodLimit(channel) && (MyUser(client) || client->srvptr->serv->flags.synced) && (client->srvptr->serv->boottime && (TStime() - client->srvptr->serv->boottime >= MODEF_BOOT_DELAY)) && !IsULine(client) && - do_floodprot(chptr, FLD_JOIN) && + do_floodprot(channel, FLD_JOIN) && MyUser(client)) { - do_floodprot_action(chptr, FLD_JOIN, "join"); + do_floodprot_action(channel, FLD_JOIN, "join"); } return 0; } @@ -878,9 +878,9 @@ int cmodef_cleanup_user2(Client *client) return 0; } -int cmodef_channel_destroy(Channel *chptr, int *should_destroy) +int cmodef_channel_destroy(Channel *channel, int *should_destroy) { - floodprottimer_stopchantimers(chptr); + floodprottimer_stopchantimers(channel); return 0; } @@ -940,36 +940,36 @@ char *channel_modef_string(ChannelFloodProtection *x, char *retbuf) return retbuf; } -char *floodprot_pre_chanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice) +char *floodprot_pre_chanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice) { - if (MyUser(client) && (check_for_chan_flood(client, chptr, text) == 1)) + if (MyUser(client) && (check_for_chan_flood(client, channel, text) == 1)) return NULL; /* don't send it */ return text; } -int floodprot_post_chanmsg(Client *client, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice) +int floodprot_post_chanmsg(Client *client, Channel *channel, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice) { - if (!IsFloodLimit(chptr) || is_skochanop(client, chptr) || IsULine(client)) + if (!IsFloodLimit(channel) || is_skochanop(client, channel) || IsULine(client)) return 0; /* HINT: don't be so stupid to reorder the items in the if's below.. you'll break things -- Syzop. */ - if (do_floodprot(chptr, FLD_MSG) && MyUser(client)) - do_floodprot_action(chptr, FLD_MSG, "msg/notice"); + if (do_floodprot(channel, FLD_MSG) && MyUser(client)) + do_floodprot_action(channel, FLD_MSG, "msg/notice"); if ((text[0] == '\001') && strncmp(text+1, "ACTION ", 7) && - do_floodprot(chptr, FLD_CTCP) && MyUser(client)) + do_floodprot(channel, FLD_CTCP) && MyUser(client)) { - do_floodprot_action(chptr, FLD_CTCP, "CTCP"); + do_floodprot_action(channel, FLD_CTCP, "CTCP"); } return 0; } -int floodprot_knock(Client *client, Channel *chptr, MessageTag *mtags, char *comment) +int floodprot_knock(Client *client, Channel *channel, MessageTag *mtags, char *comment) { - if (IsFloodLimit(chptr) && !IsULine(client) && do_floodprot(chptr, FLD_KNOCK) && MyUser(client)) - do_floodprot_action(chptr, FLD_KNOCK, "knock"); + if (IsFloodLimit(channel) && !IsULine(client) && do_floodprot(channel, FLD_KNOCK) && MyUser(client)) + do_floodprot_action(channel, FLD_KNOCK, "knock"); return 0; } @@ -979,12 +979,12 @@ Membership *mp; for (mp = client->user->channel; mp; mp = mp->next) { - Channel *chptr = mp->chptr; - if (chptr && IsFloodLimit(chptr) && + Channel *channel = mp->channel; + if (channel && IsFloodLimit(channel) && !(mp->flags & (CHFL_CHANOP|CHFL_VOICE|CHFL_CHANOWNER|CHFL_HALFOP|CHFL_CHANADMIN)) && - do_floodprot(chptr, FLD_NICK) && MyUser(client)) + do_floodprot(channel, FLD_NICK) && MyUser(client)) { - do_floodprot_action(chptr, FLD_NICK, "nick"); + do_floodprot_action(channel, FLD_NICK, "nick"); } } return 0; @@ -1004,14 +1004,14 @@ int floodprot_remote_nickchange(Client *client, char *oldnick) return gotnickchange(client); } -int floodprot_chanmode_del(Channel *chptr, int modechar) +int floodprot_chanmode_del(Channel *channel, int modechar) { ChannelFloodProtection *chp; - if (!IsFloodLimit(chptr)) + if (!IsFloodLimit(channel)) return 0; - chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f'); + chp = (ChannelFloodProtection *)GETPARASTRUCT(channel, 'f'); if (!chp) return 0; @@ -1044,11 +1044,11 @@ int floodprot_chanmode_del(Channel *chptr, int modechar) default: break; } - floodprottimer_del(chptr, modechar); + floodprottimer_del(channel, modechar); return 0; } -int check_for_chan_flood(Client *client, Channel *chptr, char *text) +int check_for_chan_flood(Client *client, Channel *channel, char *text) { Membership *mb; ChannelFloodProtection *chp; @@ -1056,13 +1056,13 @@ int check_for_chan_flood(Client *client, Channel *chptr, char *text) uint64_t msghash; unsigned char is_flooding_text=0, is_flooding_repeat=0; - if (ValidatePermissionsForPath("channel:override:flood",client,NULL,chptr,NULL) || !IsFloodLimit(chptr) || is_skochanop(client, chptr)) + if (ValidatePermissionsForPath("channel:override:flood",client,NULL,channel,NULL) || !IsFloodLimit(channel) || is_skochanop(client, channel)) return 0; - if (!(mb = find_membership_link(client->user->channel, chptr))) + if (!(mb = find_membership_link(client->user->channel, channel))) return 0; /* not in channel */ - chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f'); + chp = (ChannelFloodProtection *)GETPARASTRUCT(channel, 'f'); if (!chp || !(chp->limit[FLD_TEXT] || chp->limit[FLD_REPEAT])) return 0; @@ -1135,7 +1135,7 @@ int check_for_chan_flood(Client *client, Channel *chptr, char *text) if (chp->action[flood_type] == 'd') { /* Drop the message */ - sendnumeric(client, ERR_CANNOTSENDTOCHAN, chptr->chname, comment, chptr->chname); + sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->chname, comment, channel->chname); return 1; } @@ -1146,38 +1146,38 @@ int check_for_chan_flood(Client *client, Channel *chptr, char *text) snprintf(mask, sizeof(mask), "~t:%d:*!*@%s", chp->remove_after[flood_type], GetHost(client)); else snprintf(mask, sizeof(mask), "*!*@%s", GetHost(client)); - if (add_listmode(&chptr->banlist, &me, chptr, mask) == 0) + if (add_listmode(&channel->banlist, &me, channel, mask) == 0) { mtags = NULL; new_message(&me, NULL, &mtags); sendto_server(&me, 0, 0, mtags, ":%s MODE %s +b %s 0", - me.name, chptr->chname, mask); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, - ":%s MODE %s +b %s", me.name, chptr->chname, mask); + me.name, channel->chname, mask); + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, + ":%s MODE %s +b %s", me.name, channel->chname, mask); free_message_tags(mtags); } /* else.. ban list is full */ } mtags = NULL; new_message(&me, NULL, &mtags); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s KICK %s %s :%s", me.name, - chptr->chname, client->name, comment); + channel->chname, client->name, comment); sendto_server(NULL, 0, 0, mtags, ":%s KICK %s %s :%s", - me.name, chptr->chname, client->name, comment); + me.name, channel->chname, client->name, comment); free_message_tags(mtags); - remove_user_from_channel(client, chptr); + remove_user_from_channel(client, channel); return 1; } return 0; } -RemoveChannelModeTimer *floodprottimer_find(Channel *chptr, char mflag) +RemoveChannelModeTimer *floodprottimer_find(Channel *channel, char mflag) { RemoveChannelModeTimer *e; for (e=removechannelmodetimer_list; e; e=e->next) { - if ((e->chptr == chptr) && (e->m == mflag)) + if ((e->channel == channel) && (e->m == mflag)) return e; } return NULL; @@ -1193,26 +1193,26 @@ void strccat(char *s, char c) /* * Adds a "remove channelmode set by +f" timer. - * chptr Channel + * channel Channel * mflag Mode flag, eg 'C' * when when it should be removed * NOTES: * - This function takes care of overwriting of any previous timer * for the same modechar. - * - The function takes care of chptr->mode.floodprot->timers_running, + * - The function takes care of channel->mode.floodprot->timers_running, * do not modify it yourself. - * - chptr->mode.floodprot is asumed to be non-NULL. + * - channel->mode.floodprot is asumed to be non-NULL. */ -void floodprottimer_add(Channel *chptr, char mflag, time_t when) +void floodprottimer_add(Channel *channel, char mflag, time_t when) { RemoveChannelModeTimer *e = NULL; unsigned char add=1; - ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f'); + ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(channel, 'f'); if (strchr(chp->timers_running, mflag)) { /* Already exists... */ - e = floodprottimer_find(chptr, mflag); + e = floodprottimer_find(channel, mflag); if (e) add = 0; } @@ -1222,7 +1222,7 @@ void floodprottimer_add(Channel *chptr, char mflag, time_t when) if (strlen(chp->timers_running)+1 >= sizeof(chp->timers_running)) { sendto_realops_and_log("floodprottimer_add: too many timers running for %s (%s)!!!", - chptr->chname, chp->timers_running); + channel->chname, chp->timers_running); return; } strccat(chp->timers_running, mflag); /* bounds already checked ^^ */ @@ -1231,7 +1231,7 @@ void floodprottimer_add(Channel *chptr, char mflag, time_t when) if (add) e = safe_alloc(sizeof(RemoveChannelModeTimer)); - e->chptr = chptr; + e->channel = channel; e->m = mflag; e->when = when; @@ -1239,14 +1239,14 @@ void floodprottimer_add(Channel *chptr, char mflag, time_t when) AddListItem(e, removechannelmodetimer_list); } -void floodprottimer_del(Channel *chptr, char mflag) +void floodprottimer_del(Channel *channel, char mflag) { RemoveChannelModeTimer *e; - ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f'); + ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(channel, 'f'); if (chp && !strchr(chp->timers_running, mflag)) return; /* nothing to remove.. */ - e = floodprottimer_find(chptr, mflag); + e = floodprottimer_find(channel, mflag); if (!e) return; @@ -1281,26 +1281,26 @@ EVENT(modef_event) long mode = 0; Cmode_t extmode = 0; #ifdef NEWFLDDBG - sendto_realops("modef_event: chan %s mode -%c EXPIRED", e->chptr->chname, e->m); + sendto_realops("modef_event: chan %s mode -%c EXPIRED", e->channel->chname, e->m); #endif mode = get_mode_bitbychar(e->m); if (mode == 0) extmode = get_extmode_bitbychar(e->m); - if ((mode && (e->chptr->mode.mode & mode)) || - (extmode && (e->chptr->mode.extmode & extmode))) + if ((mode && (e->channel->mode.mode & mode)) || + (extmode && (e->channel->mode.extmode & extmode))) { MessageTag *mtags = NULL; new_message(&me, NULL, &mtags); - sendto_server(&me, 0, 0, mtags, ":%s MODE %s -%c 0", me.name, e->chptr->chname, e->m); - sendto_channel(e->chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, + sendto_server(&me, 0, 0, mtags, ":%s MODE %s -%c 0", me.name, e->channel->chname, e->m); + sendto_channel(e->channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -%c", - me.name, e->chptr->chname, e->m); + me.name, e->channel->chname, e->m); free_message_tags(mtags); - e->chptr->mode.mode &= ~mode; - e->chptr->mode.extmode &= ~extmode; + e->channel->mode.mode &= ~mode; + e->channel->mode.extmode &= ~extmode; } /* And delete... */ @@ -1309,20 +1309,20 @@ EVENT(modef_event) } else { #ifdef NEWFLDDBG sendto_realops("modef_event: chan %s mode -%c about %d seconds", - e->chptr->chname, e->m, e->when - now); + e->channel->chname, e->m, e->when - now); #endif } } } -void floodprottimer_stopchantimers(Channel *chptr) +void floodprottimer_stopchantimers(Channel *channel) { RemoveChannelModeTimer *e, *e_next; for (e = removechannelmodetimer_list; e; e = e_next) { e_next = e->next; - if (e->chptr == chptr) + if (e->channel == channel) { DelListItem(e, removechannelmodetimer_list); safe_free(e); @@ -1330,9 +1330,9 @@ void floodprottimer_stopchantimers(Channel *chptr) } } -int do_floodprot(Channel *chptr, int what) +int do_floodprot(Channel *channel, int what) { - ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f'); + ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(channel, 'f'); if (!chp || !chp->limit[what]) /* no +f or not restricted */ return 0; @@ -1360,12 +1360,12 @@ int do_floodprot(Channel *chptr, int what) return 0; } -void do_floodprot_action(Channel *chptr, int what, char *text) +void do_floodprot_action(Channel *channel, int what, char *text) { char m; int mode = 0; Cmode_t extmode = 0; - ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f'); + ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(channel, 'f'); m = chp->action[what]; if (!m) @@ -1384,8 +1384,8 @@ void do_floodprot_action(Channel *chptr, int what, char *text) if (!mode && !extmode) return; - if (!(mode && (chptr->mode.mode & mode)) && - !(extmode && (chptr->mode.extmode & extmode))) + if (!(mode && (channel->mode.mode & mode)) && + !(extmode && (channel->mode.extmode & extmode))) { char comment[512], target[CHANNELLEN + 8]; MessageTag *mtags; @@ -1395,8 +1395,8 @@ void do_floodprot_action(Channel *chptr, int what, char *text) new_message(&me, NULL, &mtags); ircsnprintf(comment, sizeof(comment), "*** Channel %sflood detected (limit is %d per %d seconds), setting mode +%c", text, chp->limit[what], chp->per, m); - ircsnprintf(target, sizeof(target), "%%%s", chptr->chname); - sendto_channel(chptr, &me, NULL, PREFIX_HALFOP|PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, + ircsnprintf(target, sizeof(target), "%%%s", channel->chname); + sendto_channel(channel, &me, NULL, PREFIX_HALFOP|PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, 0, SEND_ALL, mtags, ":%s NOTICE %s :%s", me.name, target, comment); free_message_tags(mtags); @@ -1404,18 +1404,18 @@ void do_floodprot_action(Channel *chptr, int what, char *text) /* Then the MODE broadcast */ mtags = NULL; new_message(&me, NULL, &mtags); - sendto_server(&me, 0, 0, mtags, ":%s MODE %s +%c 0", me.name, chptr->chname, m); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +%c", me.name, chptr->chname, m); + sendto_server(&me, 0, 0, mtags, ":%s MODE %s +%c 0", me.name, channel->chname, m); + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +%c", me.name, channel->chname, m); free_message_tags(mtags); /* Actually set the mode internally */ - chptr->mode.mode |= mode; - chptr->mode.extmode |= extmode; + channel->mode.mode |= mode; + channel->mode.extmode |= extmode; /* Add remove-chanmode timer */ if (chp->remove_after[what]) { - floodprottimer_add(chptr, m, TStime() + ((long)chp->remove_after[what] * 60) - 5); + floodprottimer_add(channel, m, TStime() + ((long)chp->remove_after[what] * 60) - 5); /* (since the floodprot timer event is called every 10s, we do -5 here so the accurancy will * be -5..+5, without it it would be 0..+10.) */ diff --git a/src/modules/chanmodes/history.c b/src/modules/chanmodes/history.c index 493fc8fb0..659f37455 100644 --- a/src/modules/chanmodes/history.c +++ b/src/modules/chanmodes/history.c @@ -31,7 +31,7 @@ struct HistoryChanMode { }; Cmode_t EXTMODE_HISTORY = 0L; -#define HistoryEnabled(chptr) (chptr->mode.extmode & EXTMODE_HISTORY) +#define HistoryEnabled(channel) (channel->mode.extmode & EXTMODE_HISTORY) /* The regular history cleaning (by timer) is spread out * a bit, rather than doing ALL channels every T time. @@ -54,16 +54,16 @@ static void init_config(void); int history_config_test(ConfigFile *, ConfigEntry *, int, int *); int history_config_run(ConfigFile *, ConfigEntry *, int); static int compare_history_modes(HistoryChanMode *a, HistoryChanMode *b); -int history_chanmode_is_ok(Client *client, Channel *chptr, char mode, char *para, int type, int what); +int history_chanmode_is_ok(Client *client, Channel *channel, char mode, char *para, int type, int what); void *history_chanmode_put_param(void *r_in, char *param); char *history_chanmode_get_param(void *r_in); char *history_chanmode_conv_param(char *param, Client *client); void history_chanmode_free_param(void *r); void *history_chanmode_dup_struct(void *r_in); -int history_chanmode_sjoin_check(Channel *chptr, void *ourx, void *theirx); -int history_channel_destroy(Channel *chptr, int *should_destroy); -int history_chanmsg(Client *client, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice); -int history_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]); +int history_chanmode_sjoin_check(Channel *channel, void *ourx, void *theirx); +int history_channel_destroy(Channel *channel, int *should_destroy); +int history_chanmsg(Client *client, Channel *channel, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice); +int history_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]); EVENT(history_clean); MOD_TEST() @@ -338,11 +338,11 @@ int history_parse_chanmode(char *param, int *lines, long *t) * Does the user have rights to add/remove this channel mode? * Is the supplied mode parameter ok? */ -int history_chanmode_is_ok(Client *client, Channel *chptr, char mode, char *param, int type, int what) +int history_chanmode_is_ok(Client *client, Channel *channel, char mode, char *param, int type, int what) { if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR)) { - if (IsUser(client) && is_chan_op(client, chptr)) + if (IsUser(client) && is_chan_op(client, channel)) return EX_ALLOW; if (type == EXCHK_ACCESS_ERR) /* can only be due to being halfop */ sendnumeric(client, ERR_NOTFORHALFOPS, 'H'); @@ -444,7 +444,7 @@ void *history_chanmode_dup_struct(void *r_in) * we have to deal with merging the settings on different sides * (if they differ at all). That's what we do here. */ -int history_chanmode_sjoin_check(Channel *chptr, void *ourx, void *theirx) +int history_chanmode_sjoin_check(Channel *channel, void *ourx, void *theirx) { HistoryChanMode *our = (HistoryChanMode *)ourx; HistoryChanMode *their = (HistoryChanMode *)theirx; @@ -459,23 +459,23 @@ int history_chanmode_sjoin_check(Channel *chptr, void *ourx, void *theirx) } /** Channel is destroyed (or is it?) */ -int history_channel_destroy(Channel *chptr, int *should_destroy) +int history_channel_destroy(Channel *channel, int *should_destroy) { if (*should_destroy == 0) return 0; /* channel will not be destroyed */ - history_destroy(chptr->chname); + history_destroy(channel->chname); return 0; } -int history_chanmsg(Client *client, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice) +int history_chanmsg(Client *client, Channel *channel, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice) { char buf[512]; char source[64]; HistoryChanMode *settings; - if (!HistoryEnabled(chptr)) + if (!HistoryEnabled(channel)) return 0; /* Filter out CTCP / CTCP REPLY */ @@ -496,26 +496,26 @@ int history_chanmsg(Client *client, Channel *chptr, int sendflags, int prefix, c snprintf(buf, sizeof(buf), ":%s %s %s :%s", source, notice ? "NOTICE" : "PRIVMSG", - chptr->chname, + channel->chname, text); - history_add(chptr->chname, mtags, buf); - settings = (HistoryChanMode *)GETPARASTRUCT(chptr, 'H'); - history_del(chptr->chname, settings->max_lines, settings->max_time); + history_add(channel->chname, mtags, buf); + settings = (HistoryChanMode *)GETPARASTRUCT(channel, 'H'); + history_del(channel->chname, settings->max_lines, settings->max_time); return 0; } -int history_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]) +int history_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]) { - if (!HistoryEnabled(chptr)) + if (!HistoryEnabled(channel)) return 0; if (MyUser(client)) { - HistoryChanMode *settings = (HistoryChanMode *)GETPARASTRUCT(chptr, 'H'); - history_del(chptr->chname, settings->max_lines, settings->max_time); - history_request(client, chptr->chname, NULL); + HistoryChanMode *settings = (HistoryChanMode *)GETPARASTRUCT(channel, 'H'); + history_del(channel->chname, settings->max_lines, settings->max_time); + history_request(client, channel->chname, NULL); } return 0; @@ -530,17 +530,17 @@ EVENT(history_clean) { static int hashnum = 0; int loopcnt = 0; - Channel *chptr; + Channel *channel; do { - for (chptr = hash_get_chan_bucket(hashnum); chptr; chptr = chptr->hnextch) + for (channel = hash_get_chan_bucket(hashnum); channel; channel = channel->hnextch) { - if (HistoryEnabled(chptr)) + if (HistoryEnabled(channel)) { - HistoryChanMode *settings = (HistoryChanMode *)GETPARASTRUCT(chptr, 'H'); + HistoryChanMode *settings = (HistoryChanMode *)GETPARASTRUCT(channel, 'H'); if (settings) - history_del(chptr->chname, settings->max_lines, settings->max_time); + history_del(channel->chname, settings->max_lines, settings->max_time); } } hashnum++; diff --git a/src/modules/chanmodes/issecure.c b/src/modules/chanmodes/issecure.c index d7aed2ff4..2e91c138b 100644 --- a/src/modules/chanmodes/issecure.c +++ b/src/modules/chanmodes/issecure.c @@ -39,15 +39,15 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_ISSECURE; -#define IsSecureChanIndicated(chptr) (chptr->mode.extmode & EXTCMODE_ISSECURE) +#define IsSecureChanIndicated(channel) (channel->mode.extmode & EXTCMODE_ISSECURE) -int IsSecureJoin(Channel *chptr); -int modeZ_is_ok(Client *client, Channel *chptr, char mode, char *para, int checkt, int what); -int issecure_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]); -int issecure_part(Client *client, Channel *chptr, MessageTag *mtags, char *comment); +int IsSecureJoin(Channel *channel); +int modeZ_is_ok(Client *client, Channel *channel, char mode, char *para, int checkt, int what); +int issecure_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]); +int issecure_part(Client *client, Channel *channel, MessageTag *mtags, char *comment); int issecure_quit(Client *client, MessageTag *mtags, char *comment); -int issecure_kick(Client *client, Client *victim, Channel *chptr, MessageTag *mtags, char *comment); -int issecure_chanmode(Client *client, Channel *chptr, MessageTag *mtags, +int issecure_kick(Client *client, Client *victim, Channel *channel, MessageTag *mtags, char *comment); +int issecure_chanmode(Client *client, Channel *channel, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode); @@ -93,14 +93,14 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int IsSecureJoin(Channel *chptr) +int IsSecureJoin(Channel *channel) { Hook *h; int i = 0; for (h = Hooks[HOOKTYPE_IS_CHANNEL_SECURE]; h; h = h->next) { - i = (*(h->func.intfunc))(chptr); + i = (*(h->func.intfunc))(channel); if (i != 0) break; } @@ -108,17 +108,17 @@ int IsSecureJoin(Channel *chptr) return i; } -int modeZ_is_ok(Client *client, Channel *chptr, char mode, char *para, int checkt, int what) +int modeZ_is_ok(Client *client, Channel *channel, char mode, char *para, int checkt, int what) { /* Reject any attempt to set or unset our mode. Even to IRCOps */ return EX_ALWAYS_DENY; } -int channel_has_insecure_users_butone(Channel *chptr, Client *skip) +int channel_has_insecure_users_butone(Channel *channel, Client *skip) { Member *member; - for (member = chptr->members; member; member = member->next) + for (member = channel->members; member; member = member->next) { if (member->client == skip) continue; @@ -132,10 +132,10 @@ Member *member; #define channel_has_insecure_users(x) channel_has_insecure_users_butone(x, NULL) -/* Set channel status of 'chptr' to be no longer secure (-Z) due to 'client'. +/* Set channel status of 'channel' to be no longer secure (-Z) due to 'client'. * client MAY be null! */ -void issecure_unset(Channel *chptr, Client *client, MessageTag *recv_mtags, int notice) +void issecure_unset(Channel *channel, Client *client, MessageTag *recv_mtags, int notice) { Hook *h; MessageTag *mtags; @@ -143,55 +143,55 @@ void issecure_unset(Channel *chptr, Client *client, MessageTag *recv_mtags, int if (notice) { mtags = NULL; - new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting -Z", chptr->chname); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s NOTICE %s :User '%s' joined and is not connected through SSL/TLS, setting channel -Z (insecure)", - me.name, chptr->chname, client->name); + new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting -Z", channel->chname); + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s NOTICE %s :User '%s' joined and is not connected through SSL/TLS, setting channel -Z (insecure)", + me.name, channel->chname, client->name); free_message_tags(mtags); } - chptr->mode.extmode &= ~EXTCMODE_ISSECURE; + channel->mode.extmode &= ~EXTCMODE_ISSECURE; mtags = NULL; - new_message_special(&me, recv_mtags, &mtags, "MODE %s -Z", chptr->chname); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -Z", me.name, chptr->chname); + new_message_special(&me, recv_mtags, &mtags, "MODE %s -Z", channel->chname); + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -Z", me.name, channel->chname); free_message_tags(mtags); } -/* Set channel status of 'chptr' to be secure (+Z). +/* Set channel status of 'channel' to be secure (+Z). * Channel might have been insecure (or might not have been +z) and is * now considered secure. If 'client' is non-NULL then we are now secure * thanks to this user leaving the chat. */ -void issecure_set(Channel *chptr, Client *client, MessageTag *recv_mtags, int notice) +void issecure_set(Channel *channel, Client *client, MessageTag *recv_mtags, int notice) { MessageTag *mtags; mtags = NULL; - new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting +Z", chptr->chname); + new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting +Z", channel->chname); if (notice && client) { /* note that we have to skip 'client', since when this call is being made * he is still considered a member of this channel. */ - sendto_channel(chptr, &me, client, 0, 0, SEND_LOCAL, NULL, + sendto_channel(channel, &me, client, 0, 0, SEND_LOCAL, NULL, ":%s NOTICE %s :Now all users in the channel are connected through SSL/TLS, setting channel +Z (secure)", - me.name, chptr->chname); + me.name, channel->chname); } else if (notice) { /* note the missing word 'now' in next line */ - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, NULL, + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, NULL, ":%s NOTICE %s :All users in the channel are connected through SSL/TLS, setting channel +Z (secure)", - me.name, chptr->chname); + me.name, channel->chname); } free_message_tags(mtags); - chptr->mode.extmode |= EXTCMODE_ISSECURE; + channel->mode.extmode |= EXTCMODE_ISSECURE; mtags = NULL; - new_message_special(&me, recv_mtags, &mtags, "MODE %s +Z", chptr->chname); - sendto_channel(chptr, &me, client, 0, 0, SEND_LOCAL, mtags, + new_message_special(&me, recv_mtags, &mtags, "MODE %s +Z", channel->chname); + sendto_channel(channel, &me, client, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +Z", - me.name, chptr->chname); + me.name, channel->chname); free_message_tags(mtags); } @@ -199,79 +199,79 @@ void issecure_set(Channel *chptr, Client *client, MessageTag *recv_mtags, int no * so while they can be written shorter, they would only take longer to execute! */ -int issecure_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]) +int issecure_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]) { /* Check only if chan already +zZ and the user joining is insecure (no need to count) */ - if (IsSecureJoin(chptr) && IsSecureChanIndicated(chptr) && !IsSecureConnect(client) && !IsULine(client)) - issecure_unset(chptr, client, mtags, 1); + if (IsSecureJoin(channel) && IsSecureChanIndicated(channel) && !IsSecureConnect(client) && !IsULine(client)) + issecure_unset(channel, client, mtags, 1); /* Special case for +z in modes-on-join and first user creating the channel */ - if ((chptr->users == 1) && IsSecureJoin(chptr) && !IsSecureChanIndicated(chptr) && !channel_has_insecure_users(chptr)) - issecure_set(chptr, NULL, mtags, 0); + if ((channel->users == 1) && IsSecureJoin(channel) && !IsSecureChanIndicated(channel) && !channel_has_insecure_users(channel)) + issecure_set(channel, NULL, mtags, 0); return 0; } -int issecure_part(Client *client, Channel *chptr, MessageTag *mtags, char *comment) +int issecure_part(Client *client, Channel *channel, MessageTag *mtags, char *comment) { /* Only care if chan is +z-Z and the user leaving is insecure, then count */ - if (IsSecureJoin(chptr) && !IsSecureChanIndicated(chptr) && !IsSecureConnect(client) && - !channel_has_insecure_users_butone(chptr, client)) - issecure_set(chptr, client, mtags, 1); + if (IsSecureJoin(channel) && !IsSecureChanIndicated(channel) && !IsSecureConnect(client) && + !channel_has_insecure_users_butone(channel, client)) + issecure_set(channel, client, mtags, 1); return 0; } int issecure_quit(Client *client, MessageTag *mtags, char *comment) { Membership *membership; -Channel *chptr; +Channel *channel; for (membership = client->user->channel; membership; membership=membership->next) { - chptr = membership->chptr; + channel = membership->channel; /* Identical to part */ - if (IsSecureJoin(chptr) && !IsSecureChanIndicated(chptr) && - !IsSecureConnect(client) && !channel_has_insecure_users_butone(chptr, client)) - issecure_set(chptr, client, mtags, 1); + if (IsSecureJoin(channel) && !IsSecureChanIndicated(channel) && + !IsSecureConnect(client) && !channel_has_insecure_users_butone(channel, client)) + issecure_set(channel, client, mtags, 1); } return 0; } -int issecure_kick(Client *client, Client *victim, Channel *chptr, MessageTag *mtags, char *comment) +int issecure_kick(Client *client, Client *victim, Channel *channel, MessageTag *mtags, char *comment) { /* Identical to part&quit, except we care about 'victim' and not 'client' */ - if (IsSecureJoin(chptr) && !IsSecureChanIndicated(chptr) && - !IsSecureConnect(victim) && !channel_has_insecure_users_butone(chptr, victim)) - issecure_set(chptr, victim, mtags, 1); + if (IsSecureJoin(channel) && !IsSecureChanIndicated(channel) && + !IsSecureConnect(victim) && !channel_has_insecure_users_butone(channel, victim)) + issecure_set(channel, victim, mtags, 1); return 0; } -int issecure_chanmode(Client *client, Channel *chptr, MessageTag *mtags, +int issecure_chanmode(Client *client, Channel *channel, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode) { if (!strchr(modebuf, 'z')) return 0; /* don't care */ - if (IsSecureJoin(chptr)) + if (IsSecureJoin(channel)) { /* +z is set, check if we need to +Z * Note that we need to be careful as there is a possibility that we got here * but the channel is ALREADY +z. Due to server2server MODE's. */ - if (channel_has_insecure_users(chptr)) + if (channel_has_insecure_users(channel)) { /* Should be -Z, if not already */ - if (IsSecureChanIndicated(chptr)) - issecure_unset(chptr, NULL, mtags, 0); /* would be odd if we got here ;) */ + if (IsSecureChanIndicated(channel)) + issecure_unset(channel, NULL, mtags, 0); /* would be odd if we got here ;) */ } else { /* Should be +Z, but check if it isn't already.. */ - if (!IsSecureChanIndicated(chptr)) - issecure_set(chptr, NULL, mtags, 0); + if (!IsSecureChanIndicated(channel)) + issecure_set(channel, NULL, mtags, 0); } } else { /* there was a -z, check if the channel is currently +Z and if so, set it -Z */ - if (IsSecureChanIndicated(chptr)) - issecure_unset(chptr, NULL, mtags, 0); + if (IsSecureChanIndicated(channel)) + issecure_unset(channel, NULL, mtags, 0); } return 0; } diff --git a/src/modules/chanmodes/link.c b/src/modules/chanmodes/link.c index cde2f374b..622654fa6 100644 --- a/src/modules/chanmodes/link.c +++ b/src/modules/chanmodes/link.c @@ -45,20 +45,20 @@ typedef enum { LINKTYPE_BADKEY = 7, // +k } linkType; -int cmodeL_is_ok(Client *client, Channel *chptr, char mode, char *para, int type, int what); +int cmodeL_is_ok(Client *client, Channel *channel, char mode, char *para, int type, int what); void *cmodeL_put_param(void *r_in, char *param); char *cmodeL_get_param(void *r_in); char *cmodeL_conv_param(char *param_in, Client *client); void cmodeL_free_param(void *r); void *cmodeL_dup_struct(void *r_in); -int cmodeL_sjoin_check(Channel *chptr, void *ourx, void *theirx); +int cmodeL_sjoin_check(Channel *channel, void *ourx, void *theirx); int extban_link_syntax(Client *client, int checkt, char *reason); -int extban_link_is_ok(Client *client, Channel *chptr, char *param, int checkt, int what, int what2); +int extban_link_is_ok(Client *client, Channel *channel, char *param, int checkt, int what, int what2); char *extban_link_conv_param(char *param); -int extban_link_is_banned(Client *client, Channel *chptr, char *ban, int type, char **msg, char **errmsg); -int link_doforward(Client *client, Channel *chptr, char *linked, linkType linktype); -int link_pre_localjoin_cb(Client *client, Channel *chptr, char *parv[]); +int extban_link_is_banned(Client *client, Channel *channel, char *ban, int type, char **msg, char **errmsg); +int link_doforward(Client *client, Channel *channel, char *linked, linkType linktype); +int link_pre_localjoin_cb(Client *client, Channel *channel, char *parv[]); MOD_INIT() { @@ -107,14 +107,14 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int cmodeL_is_ok(Client *client, Channel *chptr, char mode, char *para, int type, int what) +int cmodeL_is_ok(Client *client, Channel *channel, char mode, char *para, int type, int what) { if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR)) { - if (IsUser(client) && is_chanowner(client, chptr)) + if (IsUser(client) && is_chanowner(client, channel)) return EX_ALLOW; if (type == EXCHK_ACCESS_ERR) /* can only be due to being halfop */ - sendnumeric(client, ERR_CHANOWNPRIVNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->chname); return EX_DENY; } else if (type == EXCHK_PARAM) @@ -136,7 +136,7 @@ int cmodeL_is_ok(Client *client, Channel *chptr, char mode, char *para, int type clean_channelname(buf); if ((p = strchr(buf, ':'))) *p = '\0'; - if (find_channel(buf, NULL) == chptr) + if (find_channel(buf, NULL) == channel) { if (MyUser(client)) sendnumeric(client, ERR_CANNOTCHANGECHANMODE, 'L', @@ -208,7 +208,7 @@ void *cmodeL_dup_struct(void *r_in) return (void *)w; } -int cmodeL_sjoin_check(Channel *chptr, void *ourx, void *theirx) +int cmodeL_sjoin_check(Channel *channel, void *ourx, void *theirx) { aModeLEntry *our = (aModeLEntry *)ourx; aModeLEntry *their = (aModeLEntry *)theirx; @@ -235,7 +235,7 @@ int extban_link_syntax(Client *client, int checkt, char *reason) return 0; // Reject ban } -int extban_link_is_ok(Client *client, Channel *chptr, char *param, int checkt, int what, int what2) +int extban_link_is_ok(Client *client, Channel *channel, char *param, int checkt, int what, int what2) { char paramtmp[MAX_EB_LEN + 1]; char tmpmask[MAX_EB_LEN + 1]; @@ -265,7 +265,7 @@ int extban_link_is_ok(Client *client, Channel *chptr, char *param, int checkt, i // Possibly stack multiple extbans, this is a little convoluted due to extban API limitations snprintf(tmpmask, sizeof(tmpmask), "~?:%s", matchby); - if (extban_is_ok_nuh_extban(client, chptr, tmpmask, checkt, what, what2) == 0) + if (extban_is_ok_nuh_extban(client, channel, tmpmask, checkt, what, what2) == 0) return extban_link_syntax(client, checkt, "Invalid matcher"); return 1; // Is ok @@ -304,13 +304,13 @@ char *extban_link_conv_param(char *param) return retbuf; } -int extban_link_is_banned(Client *client, Channel *chptr, char *ban, int type, char **msg, char **errmsg) +int extban_link_is_banned(Client *client, Channel *channel, char *ban, int type, char **msg, char **errmsg) { // We don't actually ban here because we have to extract the channel name in PRE_LOCAL_JOIN anyways return 0; } -int link_doforward(Client *client, Channel *chptr, char *linked, linkType type) +int link_doforward(Client *client, Channel *channel, char *linked, linkType type) { char desc[64]; char *parv[3]; @@ -350,7 +350,7 @@ int link_doforward(Client *client, Channel *chptr, char *linked, linkType type) break; } - sendto_one(client, NULL, ":%s %d %s [Link] Cannot join channel %s (%s) -- transferring you to %s", me.name, ERR_LINKCHANNEL, client->name, chptr->chname, desc, linked); + sendto_one(client, NULL, ":%s %d %s [Link] Cannot join channel %s (%s) -- transferring you to %s", me.name, ERR_LINKCHANNEL, client->name, channel->chname, desc, linked); parv[0] = client->name; parv[1] = linked; parv[2] = NULL; @@ -358,7 +358,7 @@ int link_doforward(Client *client, Channel *chptr, char *linked, linkType type) return HOOK_DENY; // Original channel join = ignored } -int link_pre_localjoin_cb(Client *client, Channel *chptr, char *parv[]) +int link_pre_localjoin_cb(Client *client, Channel *channel, char *parv[]) { char *linked; int canjoin; @@ -368,11 +368,11 @@ int link_pre_localjoin_cb(Client *client, Channel *chptr, char *parv[]) char *banmask; // User might already be on this channel, let's also exclude any possible services bots early - if (IsULine(client) || find_membership_link(client->user->channel, chptr)) + if (IsULine(client) || find_membership_link(client->user->channel, channel)) return HOOK_CONTINUE; // Extbans take precedence over +L #channel and other restrictions - for(ban = chptr->banlist; ban; ban = ban->next) + for(ban = channel->banlist; ban; ban = ban->next) { if (strncmp(ban->banstr, "~f:", 3)) continue; @@ -384,47 +384,47 @@ int link_pre_localjoin_cb(Client *client, Channel *chptr, char *parv[]) continue; *banmask++ = '\0'; - if (ban_check_mask(client, chptr, banmask, BANCHK_JOIN, NULL, NULL, 0)) - return link_doforward(client, chptr, banchan, LINKTYPE_BAN); + if (ban_check_mask(client, channel, banmask, BANCHK_JOIN, NULL, NULL, 0)) + return link_doforward(client, channel, banchan, LINKTYPE_BAN); } // Either +L is not set, or it is set but the parameter isn't stored somehow - if (!(chptr->mode.extmode & EXTMODE_LINK) || !(linked = cm_getparameter(chptr, 'L'))) + if (!(channel->mode.extmode & EXTMODE_LINK) || !(linked = cm_getparameter(channel, 'L'))) return HOOK_CONTINUE; // can_join() actually returns 0 if we *can* join a channel, so we don't need to bother checking any further conditions - if (!(canjoin = can_join(client, chptr, NULL, parv))) + if (!(canjoin = can_join(client, channel, NULL, parv))) return HOOK_CONTINUE; // Oper only channel - if (has_channel_mode(chptr, 'O') && !IsOper(client)) - return link_doforward(client, chptr, linked, LINKTYPE_OPER); + if (has_channel_mode(channel, 'O') && !IsOper(client)) + return link_doforward(client, channel, linked, LINKTYPE_OPER); // SSL/TLS connected users only - if (has_channel_mode(chptr, 'z') && !IsSecureConnect(client)) - return link_doforward(client, chptr, linked, LINKTYPE_SSL); + if (has_channel_mode(channel, 'z') && !IsSecureConnect(client)) + return link_doforward(client, channel, linked, LINKTYPE_SSL); // Registered/identified users only - if (has_channel_mode(chptr, 'R') && !IsRegNick(client)) - return link_doforward(client, chptr, linked, LINKTYPE_REG); + if (has_channel_mode(channel, 'R') && !IsRegNick(client)) + return link_doforward(client, channel, linked, LINKTYPE_REG); // For a couple of conditions we can use the return value from can_join() =] switch(canjoin) { // Any ban other than our own ~f: extban case ERR_BANNEDFROMCHAN: - return link_doforward(client, chptr, linked, LINKTYPE_BAN); + return link_doforward(client, channel, linked, LINKTYPE_BAN); // Invite only case ERR_INVITEONLYCHAN: - return link_doforward(client, chptr, linked, LINKTYPE_INVITE); + return link_doforward(client, channel, linked, LINKTYPE_INVITE); // User limit case ERR_CHANNELISFULL: - return link_doforward(client, chptr, linked, LINKTYPE_LIMIT); + return link_doforward(client, channel, linked, LINKTYPE_LIMIT); // Specified channel key doesn't match case ERR_BADCHANNELKEY: - return link_doforward(client, chptr, linked, LINKTYPE_BADKEY); + return link_doforward(client, channel, linked, LINKTYPE_BADKEY); default: break; diff --git a/src/modules/chanmodes/nocolor.c b/src/modules/chanmodes/nocolor.c index 6721220f6..cd5b4489c 100644 --- a/src/modules/chanmodes/nocolor.c +++ b/src/modules/chanmodes/nocolor.c @@ -32,10 +32,10 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_NOCOLOR; -#define IsNoColor(chptr) (chptr->mode.extmode & EXTCMODE_NOCOLOR) +#define IsNoColor(channel) (channel->mode.extmode & EXTCMODE_NOCOLOR) -char *nocolor_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice); -char *nocolor_prelocalpart(Client *client, Channel *chptr, char *comment); +char *nocolor_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice); +char *nocolor_prelocalpart(Client *client, Channel *channel, char *comment); char *nocolor_prelocalquit(Client *client, char *comment); MOD_TEST() @@ -85,16 +85,16 @@ static int IsUsingColor(char *s) return 0; } -char *nocolor_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice) +char *nocolor_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice) { Hook *h; int i; - if (MyUser(client) && IsNoColor(chptr) && IsUsingColor(text)) + if (MyUser(client) && IsNoColor(channel) && IsUsingColor(text)) { for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, BYPASS_CHANMSG_COLOR); + i = (*(h->func.intfunc))(client, channel, BYPASS_CHANMSG_COLOR); if (i == HOOK_ALLOW) return text; /* bypass */ if (i != HOOK_CONTINUE) @@ -103,8 +103,8 @@ char *nocolor_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char if (!notice) { - sendnumeric(client, ERR_CANNOTSENDTOCHAN, chptr->chname, - "Color is not permitted in this channel", chptr->chname); + sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->chname, + "Color is not permitted in this channel", channel->chname); } return NULL; /* block */ } @@ -112,12 +112,12 @@ char *nocolor_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char return text; } -char *nocolor_prelocalpart(Client *client, Channel *chptr, char *comment) +char *nocolor_prelocalpart(Client *client, Channel *channel, char *comment) { if (!comment) return NULL; - if (MyUser(client) && IsNoColor(chptr) && IsUsingColor(comment)) + if (MyUser(client) && IsNoColor(channel) && IsUsingColor(comment)) return NULL; return comment; @@ -129,7 +129,7 @@ static int IsAnyChannelNoColor(Client *client) Membership *lp; for (lp = client->user->channel; lp; lp = lp->next) - if (IsNoColor(lp->chptr)) + if (IsNoColor(lp->channel)) return 1; return 0; } diff --git a/src/modules/chanmodes/noctcp.c b/src/modules/chanmodes/noctcp.c index 74d7a9440..88490100e 100644 --- a/src/modules/chanmodes/noctcp.c +++ b/src/modules/chanmodes/noctcp.c @@ -32,9 +32,9 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_NOCTCP; -#define IsNoCTCP(chptr) (chptr->mode.extmode & EXTCMODE_NOCTCP) +#define IsNoCTCP(channel) (channel->mode.extmode & EXTCMODE_NOCTCP) -char *noctcp_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice); +char *noctcp_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice); MOD_TEST() { @@ -78,14 +78,14 @@ static int IsACTCP(char *s) return 0; } -char *noctcp_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice) +char *noctcp_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice) { - if (MyUser(client) && IsNoCTCP(chptr) && IsACTCP(text)) + if (MyUser(client) && IsNoCTCP(channel) && IsACTCP(text)) { if (!notice) { - sendnumeric(client, ERR_CANNOTSENDTOCHAN, chptr->chname, - "CTCPs are not permitted in this channel", chptr->chname); + sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->chname, + "CTCPs are not permitted in this channel", channel->chname); } return NULL; diff --git a/src/modules/chanmodes/noinvite.c b/src/modules/chanmodes/noinvite.c index 7038680d7..d6874aa1d 100644 --- a/src/modules/chanmodes/noinvite.c +++ b/src/modules/chanmodes/noinvite.c @@ -32,10 +32,10 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_NOINVITE; -#define IsNoInvite(chptr) (chptr->mode.extmode & EXTCMODE_NOINVITE) +#define IsNoInvite(channel) (channel->mode.extmode & EXTCMODE_NOINVITE) -int noinvite_pre_knock(Client *client, Channel *chptr); -int noinvite_pre_invite(Client *client, Client *target, Channel *chptr, int *override); +int noinvite_pre_knock(Client *client, Channel *channel); +int noinvite_pre_invite(Client *client, Client *target, Channel *channel, int *override); MOD_TEST() { @@ -70,27 +70,27 @@ MOD_UNLOAD() } -int noinvite_pre_knock(Client *client, Channel *chptr) +int noinvite_pre_knock(Client *client, Channel *channel) { - if (MyUser(client) && IsNoInvite(chptr)) + if (MyUser(client) && IsNoInvite(channel)) { sendnumeric(client, ERR_CANNOTKNOCK, - chptr->chname, "The channel does not allow invites (+V)"); + channel->chname, "The channel does not allow invites (+V)"); return HOOK_DENY; } return HOOK_CONTINUE; } -int noinvite_pre_invite(Client *client, Client *target, Channel *chptr, int *override) +int noinvite_pre_invite(Client *client, Client *target, Channel *channel, int *override) { - if (MyUser(client) && IsNoInvite(chptr)) + if (MyUser(client) && IsNoInvite(channel)) { - if (ValidatePermissionsForPath("channel:override:invite:noinvite",client,NULL,chptr,NULL) && client == target) + if (ValidatePermissionsForPath("channel:override:invite:noinvite",client,NULL,channel,NULL) && client == target) { *override = 1; } else { - sendnumeric(client, ERR_NOINVITE, chptr->chname); + sendnumeric(client, ERR_NOINVITE, channel->chname); return HOOK_DENY; } } diff --git a/src/modules/chanmodes/nokick.c b/src/modules/chanmodes/nokick.c index db862bd80..8f180135b 100644 --- a/src/modules/chanmodes/nokick.c +++ b/src/modules/chanmodes/nokick.c @@ -31,9 +31,9 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_NOKICK; -#define IsNoKick(chptr) (chptr->mode.extmode & EXTCMODE_NOKICK) +#define IsNoKick(channel) (channel->mode.extmode & EXTCMODE_NOKICK) -int nokick_check (Client* client, Client* who, Channel *chptr, char* comment, long client_flags, long who_flags, char **reject_reason); +int nokick_check (Client* client, Client* who, Channel *channel, char* comment, long client_flags, long who_flags, char **reject_reason); MOD_TEST() { @@ -67,11 +67,11 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int nokick_check (Client* client, Client* who, Channel *chptr, char* comment, long client_flags, long who_flags, char **reject_reason) +int nokick_check (Client* client, Client* who, Channel *channel, char* comment, long client_flags, long who_flags, char **reject_reason) { static char errmsg[256]; - if (MyUser(client) && IsNoKick(chptr)) + if (MyUser(client) && IsNoKick(channel)) { ircsnprintf(errmsg, sizeof(errmsg), ":%s %d %s %s :%s", me.name, ERR_CANNOTDOCOMMAND, client->name, diff --git a/src/modules/chanmodes/noknock.c b/src/modules/chanmodes/noknock.c index 3efc39f4a..d5b36a49f 100644 --- a/src/modules/chanmodes/noknock.c +++ b/src/modules/chanmodes/noknock.c @@ -30,11 +30,11 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_NOKNOCK; -#define IsNoKnock(chptr) (chptr->mode.extmode & EXTCMODE_NOKNOCK) +#define IsNoKnock(channel) (channel->mode.extmode & EXTCMODE_NOKNOCK) -int noknock_check (Client *client, Channel *chptr); -int noknock_mode_allow(Client *client, Channel *chptr, char mode, char *para, int checkt, int what); -int noknock_mode_del (Channel *chptr, int modeChar); +int noknock_check (Client *client, Channel *channel); +int noknock_mode_allow(Client *client, Channel *channel, char mode, char *para, int checkt, int what); +int noknock_mode_del (Channel *channel, int modeChar); MOD_TEST() { @@ -70,29 +70,29 @@ MOD_UNLOAD() } -int noknock_check (Client *client, Channel *chptr) +int noknock_check (Client *client, Channel *channel) { - if (MyUser(client) && IsNoKnock(chptr)) + if (MyUser(client) && IsNoKnock(channel)) { - sendnumeric(client, ERR_CANNOTKNOCK, chptr->chname, "No knocks are allowed! (+K)"); + sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "No knocks are allowed! (+K)"); return HOOK_DENY; } return HOOK_CONTINUE; } -int noknock_mode_del (Channel *chptr, int modeChar) +int noknock_mode_del (Channel *channel, int modeChar) { // Remove noknock when we're removing invite only if (modeChar == 'i') - chptr->mode.extmode &= ~EXTCMODE_NOKNOCK; + channel->mode.extmode &= ~EXTCMODE_NOKNOCK; return 0; } -int noknock_mode_allow(Client *client, Channel *chptr, char mode, char *para, int checkt, int what) +int noknock_mode_allow(Client *client, Channel *channel, char mode, char *para, int checkt, int what) { - if (!(chptr->mode.mode & MODE_INVITEONLY)) + if (!(channel->mode.mode & MODE_INVITEONLY)) { if (checkt == EXCHK_ACCESS_ERR) { @@ -101,5 +101,5 @@ int noknock_mode_allow(Client *client, Channel *chptr, char mode, char *para, in return EX_DENY; } - return extcmode_default_requirehalfop(client, chptr, mode, para, checkt, what); + return extcmode_default_requirehalfop(client, channel, mode, para, checkt, what); } diff --git a/src/modules/chanmodes/nonickchange.c b/src/modules/chanmodes/nonickchange.c index f21881157..1d28e38a6 100644 --- a/src/modules/chanmodes/nonickchange.c +++ b/src/modules/chanmodes/nonickchange.c @@ -31,9 +31,9 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_NONICKCHANGE; -#define IsNoNickChange(chptr) (chptr->mode.extmode & EXTCMODE_NONICKCHANGE) +#define IsNoNickChange(channel) (channel->mode.extmode & EXTCMODE_NONICKCHANGE) -int nonickchange_check (Client *client, Channel *chptr); +int nonickchange_check (Client *client, Channel *channel); MOD_TEST() { @@ -67,11 +67,11 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int nonickchange_check (Client *client, Channel *chptr) +int nonickchange_check (Client *client, Channel *channel) { if (!IsOper(client) && !IsULine(client) - && IsNoNickChange(chptr) - && !is_chan_op(client, chptr)) + && IsNoNickChange(channel) + && !is_chan_op(client, channel)) { return HOOK_DENY; } diff --git a/src/modules/chanmodes/nonotice.c b/src/modules/chanmodes/nonotice.c index a79153dd2..472ea2986 100644 --- a/src/modules/chanmodes/nonotice.c +++ b/src/modules/chanmodes/nonotice.c @@ -30,9 +30,9 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_NONOTICE; -#define IsNoNotice(chptr) (chptr->mode.extmode & EXTCMODE_NONOTICE) +#define IsNoNotice(channel) (channel->mode.extmode & EXTCMODE_NONOTICE) -int nonotice_check_can_send(Client *client, Channel *chptr, Membership *lp, char **msg, char **errmsg, int notice); +int nonotice_check_can_send(Client *client, Channel *channel, Membership *lp, char **msg, char **errmsg, int notice); MOD_TEST() { @@ -65,17 +65,17 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int nonotice_check_can_send(Client *client, Channel *chptr, Membership *lp, char **msg, char **errmsg, int notice) +int nonotice_check_can_send(Client *client, Channel *channel, Membership *lp, char **msg, char **errmsg, int notice) { Hook *h; int i; - if (notice && IsNoNotice(chptr) && + if (notice && IsNoNotice(channel) && (!lp || !(lp->flags & (CHFL_CHANOP | CHFL_CHANOWNER | CHFL_CHANADMIN)))) { for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, BYPASS_CHANMSG_NOTICE); + i = (*(h->func.intfunc))(client, channel, BYPASS_CHANMSG_NOTICE); if (i == HOOK_ALLOW) return HOOK_CONTINUE; /* bypass restriction */ if (i != HOOK_CONTINUE) diff --git a/src/modules/chanmodes/operonly.c b/src/modules/chanmodes/operonly.c index b44be8fd6..4b959c031 100644 --- a/src/modules/chanmodes/operonly.c +++ b/src/modules/chanmodes/operonly.c @@ -32,10 +32,10 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_OPERONLY; -int operonly_require_oper(Client *client, Channel *chptr, char mode, char *para, int checkt, int what); -int operonly_check (Client *client, Channel *chptr, char *key, char *parv[]); -int operonly_topic_allow (Client *client, Channel *chptr); -int operonly_check_ban(Client *client, Channel *chptr); +int operonly_require_oper(Client *client, Channel *channel, char mode, char *para, int checkt, int what); +int operonly_check (Client *client, Channel *channel, char *key, char *parv[]); +int operonly_topic_allow (Client *client, Channel *channel); +int operonly_check_ban(Client *client, Channel *channel); MOD_TEST() { @@ -71,33 +71,33 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int operonly_check (Client *client, Channel *chptr, char *key, char *parv[]) +int operonly_check (Client *client, Channel *channel, char *key, char *parv[]) { - if ((chptr->mode.extmode & EXTCMODE_OPERONLY) && !ValidatePermissionsForPath("channel:operonly:join",client,NULL,chptr,NULL)) + if ((channel->mode.extmode & EXTCMODE_OPERONLY) && !ValidatePermissionsForPath("channel:operonly:join",client,NULL,channel,NULL)) return ERR_OPERONLY; return 0; } -int operonly_check_ban(Client *client, Channel *chptr) +int operonly_check_ban(Client *client, Channel *channel) { - if ((chptr->mode.extmode & EXTCMODE_OPERONLY) && + if ((channel->mode.extmode & EXTCMODE_OPERONLY) && !ValidatePermissionsForPath("channel:operonly:ban",client,NULL,NULL,NULL)) return HOOK_DENY; return HOOK_CONTINUE; } -int operonly_topic_allow (Client *client, Channel *chptr) +int operonly_topic_allow (Client *client, Channel *channel) { - if (chptr->mode.extmode & EXTCMODE_OPERONLY && !ValidatePermissionsForPath("channel:operonly:topic",client,NULL,chptr,NULL)) + if (channel->mode.extmode & EXTCMODE_OPERONLY && !ValidatePermissionsForPath("channel:operonly:topic",client,NULL,channel,NULL)) return HOOK_DENY; return HOOK_CONTINUE; } -int operonly_require_oper(Client *client, Channel *chptr, char mode, char *para, int checkt, int what) +int operonly_require_oper(Client *client, Channel *channel, char mode, char *para, int checkt, int what) { - if (!MyUser(client) || ValidatePermissionsForPath("channel:operonly:set",client,NULL,chptr,NULL)) + if (!MyUser(client) || ValidatePermissionsForPath("channel:operonly:set",client,NULL,channel,NULL)) return EX_ALLOW; if (checkt == EXCHK_ACCESS_ERR) diff --git a/src/modules/chanmodes/permanent.c b/src/modules/chanmodes/permanent.c index 45ae91e70..c4ed54732 100644 --- a/src/modules/chanmodes/permanent.c +++ b/src/modules/chanmodes/permanent.c @@ -30,15 +30,15 @@ ModuleHeader MOD_HEADER static Cmode_t EXTMODE_PERMANENT = 0L; -static int permanent_channel_destroy(Channel *chptr, int *should_destroy) +static int permanent_channel_destroy(Channel *channel, int *should_destroy) { - if (chptr->mode.extmode & EXTMODE_PERMANENT) + if (channel->mode.extmode & EXTMODE_PERMANENT) *should_destroy = 0; return 0; } -static int permanent_is_ok(Client *client, Channel *chptr, char mode, char *para, int checkt, int what) +static int permanent_is_ok(Client *client, Channel *channel, char mode, char *para, int checkt, int what) { if (!IsOper(client)) { @@ -51,11 +51,11 @@ static int permanent_is_ok(Client *client, Channel *chptr, char mode, char *para return EX_ALLOW; } -int permanent_chanmode(Client *client, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode) +int permanent_chanmode(Client *client, Channel *channel, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode) { /* Destroy the channel if it was set '(SA)MODE #chan -P' with nobody in it (#4442) */ - if (!(chptr->mode.extmode & EXTMODE_PERMANENT) && (chptr->users <= 0)) - sub1_from_channel(chptr); + if (!(channel->mode.extmode & EXTMODE_PERMANENT) && (channel->users <= 0)) + sub1_from_channel(channel); return 0; } diff --git a/src/modules/chanmodes/regonly.c b/src/modules/chanmodes/regonly.c index 611e3995a..8b1b5598b 100644 --- a/src/modules/chanmodes/regonly.c +++ b/src/modules/chanmodes/regonly.c @@ -31,9 +31,9 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_REGONLY; -#define IsRegOnly(chptr) (chptr->mode.extmode & EXTCMODE_REGONLY) +#define IsRegOnly(channel) (channel->mode.extmode & EXTCMODE_REGONLY) -int regonly_check (Client *client, Channel *chptr, char *key, char *parv[]); +int regonly_check (Client *client, Channel *channel, char *key, char *parv[]); MOD_TEST() @@ -68,9 +68,9 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int regonly_check (Client *client, Channel *chptr, char *key, char *parv[]) +int regonly_check (Client *client, Channel *channel, char *key, char *parv[]) { - if (IsRegOnly(chptr) && !IsLoggedIn(client)) + if (IsRegOnly(channel) && !IsLoggedIn(client)) return ERR_NEEDREGGEDNICK; return 0; } diff --git a/src/modules/chanmodes/regonlyspeak.c b/src/modules/chanmodes/regonlyspeak.c index 439f3629a..7800cbdf8 100644 --- a/src/modules/chanmodes/regonlyspeak.c +++ b/src/modules/chanmodes/regonlyspeak.c @@ -32,10 +32,10 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_REGONLYSPEAK; static char errMsg[2048]; -#define IsRegOnlySpeak(chptr) (chptr->mode.extmode & EXTCMODE_REGONLYSPEAK) +#define IsRegOnlySpeak(channel) (channel->mode.extmode & EXTCMODE_REGONLYSPEAK) -int regonlyspeak_can_send(Client *client, Channel *chptr, Membership *lp, char **msg, char **errmsg, int notice); -char *regonlyspeak_part_message (Client* client, Channel *chptr, char* comment); +int regonlyspeak_can_send(Client *client, Channel *channel, Membership *lp, char **msg, char **errmsg, int notice); +char *regonlyspeak_part_message (Client* client, Channel *channel, char* comment); MOD_TEST() { @@ -70,30 +70,30 @@ MOD_UNLOAD() return MOD_SUCCESS; } -char *regonlyspeak_part_message (Client *client, Channel *chptr, char *comment) +char *regonlyspeak_part_message (Client *client, Channel *channel, char *comment) { if (!comment) return NULL; - if (IsRegOnlySpeak(chptr) && !IsLoggedIn(client) && !ValidatePermissionsForPath("channel:override:message:regonlyspeak",client,NULL,NULL,NULL)) + if (IsRegOnlySpeak(channel) && !IsLoggedIn(client) && !ValidatePermissionsForPath("channel:override:message:regonlyspeak",client,NULL,NULL,NULL)) return NULL; return comment; } -int regonlyspeak_can_send(Client *client, Channel *chptr, Membership *lp, char **msg, char **errmsg, int notice) +int regonlyspeak_can_send(Client *client, Channel *channel, Membership *lp, char **msg, char **errmsg, int notice) { Hook *h; int i; - if (IsRegOnlySpeak(chptr) && !op_can_override("channel:override:message:regonlyspeak",client,chptr,NULL) && !IsLoggedIn(client) && + if (IsRegOnlySpeak(channel) && !op_can_override("channel:override:message:regonlyspeak",client,channel,NULL) && !IsLoggedIn(client) && (!lp || !(lp->flags & (CHFL_CHANOP | CHFL_VOICE | CHFL_CHANOWNER | CHFL_HALFOP | CHFL_CHANADMIN)))) { for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, BYPASS_CHANMSG_MODERATED); + i = (*(h->func.intfunc))(client, channel, BYPASS_CHANMSG_MODERATED); if (i == HOOK_ALLOW) return HOOK_CONTINUE; /* bypass +M restriction */ if (i != HOOK_CONTINUE) diff --git a/src/modules/chanmodes/secureonly.c b/src/modules/chanmodes/secureonly.c index 00eecca04..fa2aac0bd 100644 --- a/src/modules/chanmodes/secureonly.c +++ b/src/modules/chanmodes/secureonly.c @@ -30,14 +30,14 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_SECUREONLY; -#define IsSecureOnly(chptr) (chptr->mode.extmode & EXTCMODE_SECUREONLY) +#define IsSecureOnly(channel) (channel->mode.extmode & EXTCMODE_SECUREONLY) -int secureonly_check_join(Client *client, Channel *chptr, char *key, char *parv[]); -int secureonly_channel_sync (Channel *chptr, int merge, int removetheirs, int nomode); -int secureonly_send_channel(Client *client, Channel *chptr); -int secureonly_check_secure(Channel *chptr); -int secureonly_check_sajoin(Client *target, Channel *chptr, Client *requester); -int secureonly_specialcheck(Client *client, Channel *chptr, char *parv[]); +int secureonly_check_join(Client *client, Channel *channel, char *key, char *parv[]); +int secureonly_channel_sync (Channel *channel, int merge, int removetheirs, int nomode); +int secureonly_send_channel(Client *client, Channel *channel); +int secureonly_check_secure(Channel *channel); +int secureonly_check_sajoin(Client *target, Channel *channel, Client *requester); +int secureonly_specialcheck(Client *client, Channel *channel, char *parv[]); MOD_TEST() { @@ -80,7 +80,7 @@ MOD_UNLOAD() /** Kicks all insecure users on a +z channel * Returns 1 if the channel was destroyed as a result of this. */ -static int secureonly_kick_insecure_users(Channel *chptr) +static int secureonly_kick_insecure_users(Channel *channel) { Member *member, *mb2; Client *client; @@ -88,10 +88,10 @@ static int secureonly_kick_insecure_users(Channel *chptr) Hook *h; char *comment = "Insecure user not allowed on secure channel (+z)"; - if (!IsSecureOnly(chptr)) + if (!IsSecureOnly(channel)) return 0; - for (member = chptr->members; member; member = mb2) + for (member = channel->members; member; member = mb2) { mb2 = member->next; client = member->client; @@ -100,7 +100,7 @@ static int secureonly_kick_insecure_users(Channel *chptr) int prefix = 0; MessageTag *mtags = NULL; - if (invisible_user_in_channel(client, chptr)) + if (invisible_user_in_channel(client, channel)) { /* Send only to chanops */ prefix = CHFL_HALFOP|CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN; @@ -108,40 +108,40 @@ static int secureonly_kick_insecure_users(Channel *chptr) new_message(&me, NULL, &mtags); - RunHook6(HOOKTYPE_LOCAL_KICK, &me, &me, client, chptr, mtags, comment); + RunHook6(HOOKTYPE_LOCAL_KICK, &me, &me, client, channel, mtags, comment); - sendto_channel(chptr, &me, client, + sendto_channel(channel, &me, client, prefix, 0, SEND_LOCAL, mtags, ":%s KICK %s %s :%s", - me.name, chptr->chname, client->name, comment); + me.name, channel->chname, client->name, comment); - sendto_prefix_one(client, &me, mtags, ":%s KICK %s %s :%s", me.name, chptr->chname, client->name, comment); + sendto_prefix_one(client, &me, mtags, ":%s KICK %s %s :%s", me.name, channel->chname, client->name, comment); - sendto_server(&me, 0, 0, mtags, ":%s KICK %s %s :%s", me.name, chptr->chname, client->name, comment); + sendto_server(&me, 0, 0, mtags, ":%s KICK %s %s :%s", me.name, channel->chname, client->name, comment); free_message_tags(mtags); - if (remove_user_from_channel(client, chptr) == 1) + if (remove_user_from_channel(client, channel) == 1) return 1; /* channel was destroyed */ } } return 0; } -int secureonly_check_join(Client *client, Channel *chptr, char *key, char *parv[]) +int secureonly_check_join(Client *client, Channel *channel, char *key, char *parv[]) { Link *lp; - if (IsSecureOnly(chptr) && !(client->umodes & UMODE_SECURE)) + if (IsSecureOnly(channel) && !(client->umodes & UMODE_SECURE)) { - if (ValidatePermissionsForPath("channel:override:secureonly",client,NULL,chptr,NULL)) + if (ValidatePermissionsForPath("channel:override:secureonly",client,NULL,channel,NULL)) { /* if the channel is +z we still allow an ircop to bypass it * if they are invited. */ for (lp = client->user->invited; lp; lp = lp->next) - if (lp->value.chptr == chptr) + if (lp->value.channel == channel) return HOOK_CONTINUE; } return (ERR_SECUREONLYCHAN); @@ -149,9 +149,9 @@ int secureonly_check_join(Client *client, Channel *chptr, char *key, char *parv[ return 0; } -int secureonly_check_secure(Channel *chptr) +int secureonly_check_secure(Channel *channel) { - if (IsSecureOnly(chptr)) + if (IsSecureOnly(channel)) { return 1; } @@ -159,28 +159,28 @@ int secureonly_check_secure(Channel *chptr) return 0; } -int secureonly_channel_sync(Channel *chptr, int merge, int removetheirs, int nomode) +int secureonly_channel_sync(Channel *channel, int merge, int removetheirs, int nomode) { if (!merge && !removetheirs && !nomode) - return secureonly_kick_insecure_users(chptr); /* may return 1, meaning channel is destroyed */ + return secureonly_kick_insecure_users(channel); /* may return 1, meaning channel is destroyed */ return 0; } -int secureonly_send_channel(Client *client, Channel *chptr) +int secureonly_send_channel(Client *client, Channel *channel) { - if (IsSecureOnly(chptr)) + if (IsSecureOnly(channel)) if (!IsSecure(client)) return HOOK_DENY; return HOOK_CONTINUE; } -int secureonly_check_sajoin(Client *target, Channel *chptr, Client *requester) +int secureonly_check_sajoin(Client *target, Channel *channel, Client *requester) { - if (IsSecureOnly(chptr) && !IsSecure(target)) + if (IsSecureOnly(channel) && !IsSecure(target)) { sendnotice(requester, "You cannot SAJOIN %s to %s because the channel is +z and the user is not connected via SSL/TLS", - target->name, chptr->chname); + target->name, channel->chname); return HOOK_DENY; } @@ -190,11 +190,11 @@ int secureonly_check_sajoin(Client *target, Channel *chptr, Client *requester) /* Special check for +z in set::modes-on-join. Needs to be done early. * Perhaps one day this will be properly handled in the core so this can be removed. */ -int secureonly_specialcheck(Client *client, Channel *chptr, char *parv[]) +int secureonly_specialcheck(Client *client, Channel *channel, char *parv[]) { - if ((chptr->users == 0) && (iConf.modes_on_join.extmodes & EXTCMODE_SECUREONLY) && !IsSecure(client) && !IsOper(client)) + if ((channel->users == 0) && (iConf.modes_on_join.extmodes & EXTCMODE_SECUREONLY) && !IsSecure(client) && !IsOper(client)) { - sendnumeric(client, ERR_SECUREONLYCHAN, chptr->chname); + sendnumeric(client, ERR_SECUREONLYCHAN, channel->chname); return HOOK_DENY; } return HOOK_CONTINUE; diff --git a/src/modules/chanmodes/stripcolor.c b/src/modules/chanmodes/stripcolor.c index efccef928..6dc6c59f7 100644 --- a/src/modules/chanmodes/stripcolor.c +++ b/src/modules/chanmodes/stripcolor.c @@ -32,10 +32,10 @@ ModuleHeader MOD_HEADER Cmode_t EXTCMODE_STRIPCOLOR; -#define IsStripColor(chptr) (chptr->mode.extmode & EXTCMODE_STRIPCOLOR) +#define IsStripColor(channel) (channel->mode.extmode & EXTCMODE_STRIPCOLOR) -char *stripcolor_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice); -char *stripcolor_prelocalpart(Client *client, Channel *chptr, char *comment); +char *stripcolor_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice); +char *stripcolor_prelocalpart(Client *client, Channel *channel, char *comment); char *stripcolor_prelocalquit(Client *client, char *comment); MOD_TEST() @@ -73,16 +73,16 @@ MOD_UNLOAD() return MOD_SUCCESS; } -char *stripcolor_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice) +char *stripcolor_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice) { Hook *h; int i; - if (MyUser(client) && IsStripColor(chptr)) + if (MyUser(client) && IsStripColor(channel)) { for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, BYPASS_CHANMSG_COLOR); + i = (*(h->func.intfunc))(client, channel, BYPASS_CHANMSG_COLOR); if (i == HOOK_ALLOW) return text; /* bypass */ if (i != HOOK_CONTINUE) @@ -95,12 +95,12 @@ char *stripcolor_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, c return text; } -char *stripcolor_prelocalpart(Client *client, Channel *chptr, char *comment) +char *stripcolor_prelocalpart(Client *client, Channel *channel, char *comment) { if (!comment) return NULL; - if (MyUser(client) && IsStripColor(chptr)) + if (MyUser(client) && IsStripColor(channel)) comment = StripColors(comment); return comment; @@ -112,7 +112,7 @@ static int IsAnyChannelStripColor(Client *client) Membership *lp; for (lp = client->user->channel; lp; lp = lp->next) - if (IsStripColor(lp->chptr)) + if (IsStripColor(lp->channel)) return 1; return 0; } diff --git a/src/modules/channeldb.c b/src/modules/channeldb.c index e1f956d2f..91637b606 100644 --- a/src/modules/channeldb.c +++ b/src/modules/channeldb.c @@ -49,9 +49,9 @@ int channeldb_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs); int channeldb_configrun(ConfigFile *cf, ConfigEntry *ce, int type); EVENT(write_channeldb_evt); int write_channeldb(void); -int write_channel_entry(FILE *fd, const char *tmpfname, Channel *chptr); +int write_channel_entry(FILE *fd, const char *tmpfname, Channel *channel); int read_channeldb(void); -static void set_channel_mode(Channel *chptr, char *modes, char *parameters); +static void set_channel_mode(Channel *channel, char *modes, char *parameters); /* Global variables */ static uint32_t channeldb_version = CHANNELDB_VERSION; @@ -191,7 +191,7 @@ int write_channeldb(void) { char tmpfname[512]; FILE *fd; - Channel *chptr; + Channel *channel; int cnt = 0; #ifdef BENCHMARK struct timeval tv_alpha, tv_beta; @@ -211,17 +211,17 @@ int write_channeldb(void) W_SAFE(write_data(fd, &channeldb_version, sizeof(channeldb_version))); /* First, count +P channels and write the count to the database */ - for (chptr = channels; chptr; chptr=chptr->nextch) - if (has_channel_mode(chptr, 'P')) + for (channel = channels; channel; channel=channel->nextch) + if (has_channel_mode(channel, 'P')) cnt++; W_SAFE(write_int64(fd, cnt)); - for (chptr = channels; chptr; chptr=chptr->nextch) + for (channel = channels; channel; channel=channel->nextch) { /* We only care about +P (persistent) channels */ - if (has_channel_mode(chptr, 'P')) + if (has_channel_mode(channel, 'P')) { - if (!write_channel_entry(fd, tmpfname, chptr)) + if (!write_channel_entry(fd, tmpfname, channel)) return 0; } } @@ -266,29 +266,29 @@ int write_listmode(FILE *fd, const char *tmpfname, Ban *lst) return 1; } -int write_channel_entry(FILE *fd, const char *tmpfname, Channel *chptr) +int write_channel_entry(FILE *fd, const char *tmpfname, Channel *channel) { W_SAFE(write_int32(fd, MAGIC_CHANNEL_START)); /* Channel name */ - W_SAFE(write_str(fd, chptr->chname)); + W_SAFE(write_str(fd, channel->chname)); /* Channel creation time */ - W_SAFE(write_int64(fd, chptr->creationtime)); + W_SAFE(write_int64(fd, channel->creationtime)); /* Topic (topic, setby, seton) */ - W_SAFE(write_str(fd, chptr->topic)); - W_SAFE(write_str(fd, chptr->topic_nick)); - W_SAFE(write_int64(fd, chptr->topic_time)); + W_SAFE(write_str(fd, channel->topic)); + W_SAFE(write_str(fd, channel->topic_nick)); + W_SAFE(write_int64(fd, channel->topic_time)); /* Basic channel modes (eg: +sntkl key 55) */ - channel_modes(&me, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr); + channel_modes(&me, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel); W_SAFE(write_str(fd, modebuf)); W_SAFE(write_str(fd, parabuf)); /* Mode lock */ - W_SAFE(write_str(fd, chptr->mode_lock)); + W_SAFE(write_str(fd, channel->mode_lock)); /* List modes (bans, exempts, invex) */ - if (!write_listmode(fd, tmpfname, chptr->banlist)) + if (!write_listmode(fd, tmpfname, channel->banlist)) return 0; - if (!write_listmode(fd, tmpfname, chptr->exlist)) + if (!write_listmode(fd, tmpfname, channel->exlist)) return 0; - if (!write_listmode(fd, tmpfname, chptr->invexlist)) + if (!write_listmode(fd, tmpfname, channel->invexlist)) return 0; W_SAFE(write_int32(fd, MAGIC_CHANNEL_END)); return 1; @@ -413,7 +413,7 @@ int read_channeldb(void) modes2 = NULL; mode_lock = NULL; - Channel *chptr; + Channel *channel; R_SAFE(read_data(fd, &magic, sizeof(magic))); if (magic != MAGIC_CHANNEL_START) { @@ -429,16 +429,16 @@ int read_channeldb(void) R_SAFE(read_str(fd, &modes2)); R_SAFE(read_str(fd, &mode_lock)); /* If we got this far, we can create/initialize the channel with the above */ - chptr = get_channel(&me, chname, CREATE); - chptr->creationtime = creationtime; - safe_strdup(chptr->topic, topic); - safe_strdup(chptr->topic_nick, topic_nick); - chptr->topic_time = topic_time; - safe_strdup(chptr->mode_lock, mode_lock); - set_channel_mode(chptr, modes1, modes2); - R_SAFE(read_listmode(fd, &chptr->banlist)); - R_SAFE(read_listmode(fd, &chptr->exlist)); - R_SAFE(read_listmode(fd, &chptr->invexlist)); + channel = get_channel(&me, chname, CREATE); + channel->creationtime = creationtime; + safe_strdup(channel->topic, topic); + safe_strdup(channel->topic_nick, topic_nick); + channel->topic_time = topic_time; + safe_strdup(channel->mode_lock, mode_lock); + set_channel_mode(channel, modes1, modes2); + R_SAFE(read_listmode(fd, &channel->banlist)); + R_SAFE(read_listmode(fd, &channel->exlist)); + R_SAFE(read_listmode(fd, &channel->invexlist)); R_SAFE(read_data(fd, &magic, sizeof(magic))); FreeChannelEntry(); added++; @@ -466,7 +466,7 @@ int read_channeldb(void) #undef FreeChannelEntry #undef R_SAFE -static void set_channel_mode(Channel *chptr, char *modes, char *parameters) +static void set_channel_mode(Channel *channel, char *modes, char *parameters) { char buf[512]; char *p, *param; @@ -482,7 +482,7 @@ static void set_channel_mode(Channel *chptr, char *modes, char *parameters) myparv[myparc] = NULL; SetULine(&me); // hack for crash.. set ulined so no access checks. - do_mode(chptr, &me, NULL, myparc, myparv, 0, 0); + do_mode(channel, &me, NULL, myparc, myparv, 0, 0); SetULine(&me); // and clear it again.. for (i = 0; i < myparc; i++) diff --git a/src/modules/echo-message.c b/src/modules/echo-message.c index c510bf112..20d856558 100644 --- a/src/modules/echo-message.c +++ b/src/modules/echo-message.c @@ -35,7 +35,7 @@ ModuleHeader MOD_HEADER long CAP_ECHO_MESSAGE = 0L; /* Forward declarations */ -int em_chanmsg(Client *client, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice); +int em_chanmsg(Client *client, Channel *channel, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice); int em_usermsg(Client *client, Client *to, MessageTag *mtags, char *text, int notice); MOD_INIT() @@ -64,7 +64,7 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int em_chanmsg(Client *client, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice) +int em_chanmsg(Client *client, Channel *channel, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice) { if (MyUser(client) && HasCapabilityFast(client, CAP_ECHO_MESSAGE)) { diff --git a/src/modules/extbans/account.c b/src/modules/extbans/account.c index c18e672f7..12192de05 100644 --- a/src/modules/extbans/account.c +++ b/src/modules/extbans/account.c @@ -29,7 +29,7 @@ ModuleHeader MOD_HEADER /* Forward declarations */ char *extban_account_conv_param(char *para); -int extban_account_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); +int extban_account_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); /** Called upon module init */ MOD_INIT() @@ -78,7 +78,7 @@ char *extban_account_conv_param(char *para) return retbuf; } -int extban_account_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg) +int extban_account_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg) { char *ban = banin+3; diff --git a/src/modules/extbans/certfp.c b/src/modules/extbans/certfp.c index 6b615ccdb..07767b740 100644 --- a/src/modules/extbans/certfp.c +++ b/src/modules/extbans/certfp.c @@ -28,9 +28,9 @@ ModuleHeader MOD_HEADER }; /* Forward declarations */ -int extban_certfp_is_ok(Client *client, Channel *chptr, char *para, int checkt, int what, int what2); +int extban_certfp_is_ok(Client *client, Channel *channel, char *para, int checkt, int what, int what2); char *extban_certfp_conv_param(char *para); -int extban_certfp_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); +int extban_certfp_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); /* Called upon module init */ MOD_INIT() @@ -74,7 +74,7 @@ int extban_certfp_usage(Client *client) return EX_DENY; } -int extban_certfp_is_ok(Client *client, Channel *chptr, char *para, int checkt, int what, int what2) +int extban_certfp_is_ok(Client *client, Channel *channel, char *para, int checkt, int what, int what2) { if (checkt == EXCHK_PARAM) { @@ -108,7 +108,7 @@ char *extban_certfp_conv_param(char *para) return retbuf; } -int extban_certfp_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg) +int extban_certfp_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg) { char *ban = banin+3; char *fp; diff --git a/src/modules/extbans/inchannel.c b/src/modules/extbans/inchannel.c index 921bd4f1e..58990ea94 100644 --- a/src/modules/extbans/inchannel.c +++ b/src/modules/extbans/inchannel.c @@ -28,9 +28,9 @@ ModuleHeader MOD_HEADER }; /* Forward declarations */ -int extban_inchannel_is_ok(Client *client, Channel *chptr, char *para, int checkt, int what, int what2); +int extban_inchannel_is_ok(Client *client, Channel *channel, char *para, int checkt, int what, int what2); char *extban_inchannel_conv_param(char *para); -int extban_inchannel_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); +int extban_inchannel_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); /** Called upon module init */ MOD_INIT() @@ -94,7 +94,7 @@ char *extban_inchannel_conv_param(char *para) } /* The only purpose of this function is a temporary workaround to prevent a desynch.. pfff */ -int extban_inchannel_is_ok(Client *client, Channel *chptr, char *para, int checkt, int what, int what2) +int extban_inchannel_is_ok(Client *client, Channel *channel, char *para, int checkt, int what, int what2) { char *p; @@ -135,7 +135,7 @@ static int extban_inchannel_compareflags(char symbol, int flags) return 0; } -int extban_inchannel_is_banned(Client *client, Channel *chptr, char *ban, int type, char **msg, char **errmsg) +int extban_inchannel_is_banned(Client *client, Channel *channel, char *ban, int type, char **msg, char **errmsg) { Membership *lp; char *p = ban+3, symbol = '\0'; @@ -148,7 +148,7 @@ int extban_inchannel_is_banned(Client *client, Channel *chptr, char *ban, int ty for (lp = client->user->channel; lp; lp = lp->next) { - if (match_esc(p, lp->chptr->chname)) + if (match_esc(p, lp->channel->chname)) { /* Channel matched, check symbol if needed (+/%/@/etc) */ if (symbol) diff --git a/src/modules/extbans/join.c b/src/modules/extbans/join.c index be0ba4ae2..050b43efe 100644 --- a/src/modules/extbans/join.c +++ b/src/modules/extbans/join.c @@ -28,7 +28,7 @@ ModuleHeader MOD_HEADER }; /* Forward declarations */ -int extban_modej_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); +int extban_modej_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); /** Called upon module init */ MOD_INIT() @@ -64,7 +64,7 @@ MOD_UNLOAD() } /** This ban that affects JOINs only */ -int extban_modej_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg) +int extban_modej_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg) { char *sub_ban; @@ -73,6 +73,6 @@ int extban_modej_is_banned(Client *client, Channel *chptr, char *banin, int type sub_ban = banin + 3; - return ban_check_mask(client, chptr, sub_ban, type, msg, errmsg, 0); + return ban_check_mask(client, channel, sub_ban, type, msg, errmsg, 0); } diff --git a/src/modules/extbans/msgbypass.c b/src/modules/extbans/msgbypass.c index 5d45ef51d..4bc0166a6 100644 --- a/src/modules/extbans/msgbypass.c +++ b/src/modules/extbans/msgbypass.c @@ -28,9 +28,9 @@ ModuleHeader MOD_HEADER }; /* Forward declarations */ -int extban_msgbypass_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); -int msgbypass_can_bypass(Client *client, Channel *chptr, BypassChannelMessageRestrictionType bypass_type); -int msgbypass_extban_is_ok(Client* client, Channel* chptr, char* para, int checkt, int what, int what2); +int extban_msgbypass_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); +int msgbypass_can_bypass(Client *client, Channel *channel, BypassChannelMessageRestrictionType bypass_type); +int msgbypass_extban_is_ok(Client* client, Channel* channel, char* para, int checkt, int what, int what2); char *msgbypass_extban_conv_param(char *para); /** Called upon module init */ @@ -68,18 +68,18 @@ MOD_UNLOAD() } /** Is the user banned? No, never by us anyway. */ -int extban_msgbypass_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg) +int extban_msgbypass_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg) { return 0; /* not banned by us */ } /** Can the user bypass restrictions? */ -int msgbypass_can_bypass(Client *client, Channel *chptr, BypassChannelMessageRestrictionType bypass_type) +int msgbypass_can_bypass(Client *client, Channel *channel, BypassChannelMessageRestrictionType bypass_type) { Ban *ban; char *p; - for (ban = chptr->exlist; ban; ban=ban->next) + for (ban = channel->exlist; ban; ban=ban->next) { if ((ban->banstr[0] == '~') && (ban->banstr[1] == 'm') && (ban->banstr[2] == ':')) { @@ -97,7 +97,7 @@ int msgbypass_can_bypass(Client *client, Channel *chptr, BypassChannelMessageRes continue; matchby++; - if (ban_check_mask(client, chptr, matchby, BANCHK_MSG, NULL, NULL, 0)) + if (ban_check_mask(client, channel, matchby, BANCHK_MSG, NULL, NULL, 0)) return HOOK_ALLOW; /* Yes, user may bypass */ } } @@ -171,7 +171,7 @@ int msgbypass_extban_syntax(Client *client, int checkt, char *reason) return 0; /* FAIL: ban rejected */ } -int msgbypass_extban_is_ok(Client* client, Channel* chptr, char* para_in, int checkt, int what, int what2) +int msgbypass_extban_is_ok(Client* client, Channel* channel, char* para_in, int checkt, int what, int what2) { char para[MAX_LENGTH+1]; char tmpmask[MAX_LENGTH+1]; @@ -210,7 +210,7 @@ int msgbypass_extban_is_ok(Client* client, Channel* chptr, char* para_in, int ch * expecting the full banmask rather than the portion that actually matters. */ snprintf(tmpmask, sizeof(tmpmask), "~?:%s", matchby); - if (extban_is_ok_nuh_extban(client, chptr, tmpmask, checkt, what, what2) == 0) + if (extban_is_ok_nuh_extban(client, channel, tmpmask, checkt, what, what2) == 0) { /* This could be anything ranging from: * invalid n!u@h syntax, unknown (sub)extbantype, diff --git a/src/modules/extbans/nickchange.c b/src/modules/extbans/nickchange.c index 2ec0ac904..164fbc085 100644 --- a/src/modules/extbans/nickchange.c +++ b/src/modules/extbans/nickchange.c @@ -28,7 +28,7 @@ ModuleHeader MOD_HEADER }; /* Forward declarations */ -int extban_nickchange_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); +int extban_nickchange_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); /** Called upon module init */ MOD_INIT() @@ -64,18 +64,18 @@ MOD_UNLOAD() } /** This ban that affects nick-changes only */ -int extban_nickchange_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg) +int extban_nickchange_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg) { char *sub_ban; if (type != BANCHK_NICK) return 0; - if (has_voice(client, chptr)) + if (has_voice(client, channel)) return 0; sub_ban = banin + 3; - return ban_check_mask(client, chptr, sub_ban, type, msg, errmsg, 0); + return ban_check_mask(client, channel, sub_ban, type, msg, errmsg, 0); } diff --git a/src/modules/extbans/operclass.c b/src/modules/extbans/operclass.c index 2a0c45469..d142ca326 100644 --- a/src/modules/extbans/operclass.c +++ b/src/modules/extbans/operclass.c @@ -29,7 +29,7 @@ ModuleHeader MOD_HEADER /* Forward declarations */ char *extban_operclass_conv_param(char *para); -int extban_operclass_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); +int extban_operclass_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); /** Called upon module init */ MOD_INIT() @@ -85,7 +85,7 @@ char *extban_operclass_conv_param(char *para) return retbuf; } -int extban_operclass_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg) +int extban_operclass_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg) { char *ban = banin+3; diff --git a/src/modules/extbans/partmsg.c b/src/modules/extbans/partmsg.c index 21124935c..10c3651ba 100644 --- a/src/modules/extbans/partmsg.c +++ b/src/modules/extbans/partmsg.c @@ -28,7 +28,7 @@ ModuleHeader MOD_HEADER "unrealircd-5", }; -int extban_partmsg_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); +int extban_partmsg_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); MOD_INIT() { @@ -62,7 +62,7 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int extban_partmsg_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg) +int extban_partmsg_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg) { if (type == BANCHK_LEAVE_MSG) *msg = NULL; diff --git a/src/modules/extbans/quiet.c b/src/modules/extbans/quiet.c index 7f5808635..2f7d7873b 100644 --- a/src/modules/extbans/quiet.c +++ b/src/modules/extbans/quiet.c @@ -28,7 +28,7 @@ ModuleHeader MOD_HEADER }; /* Forward declarations */ -int extban_quiet_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); +int extban_quiet_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); /** Called upon module init */ MOD_INIT() @@ -64,7 +64,7 @@ MOD_UNLOAD() } /** This ban that affects messages/notices only */ -int extban_quiet_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg) +int extban_quiet_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg) { char *sub_ban; @@ -73,5 +73,5 @@ int extban_quiet_is_banned(Client *client, Channel *chptr, char *banin, int type sub_ban = banin + 3; - return ban_check_mask(client, chptr, sub_ban, type, msg, errmsg, 0); + return ban_check_mask(client, channel, sub_ban, type, msg, errmsg, 0); } diff --git a/src/modules/extbans/realname.c b/src/modules/extbans/realname.c index ea0bce493..4bc947bf1 100644 --- a/src/modules/extbans/realname.c +++ b/src/modules/extbans/realname.c @@ -29,7 +29,7 @@ ModuleHeader MOD_HEADER /* Forward declarations */ char *extban_realname_conv_param(char *para); -int extban_realname_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg); +int extban_realname_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg); /** Called upon module init */ MOD_INIT() @@ -83,7 +83,7 @@ char *extban_realname_conv_param(char *para) return retbuf; } -int extban_realname_is_banned(Client *client, Channel *chptr, char *banin, int type, char **msg, char **errmsg) +int extban_realname_is_banned(Client *client, Channel *channel, char *banin, int type, char **msg, char **errmsg) { char *ban = banin+3; diff --git a/src/modules/extbans/textban.c b/src/modules/extbans/textban.c index 9e47fd604..c5eeab620 100644 --- a/src/modules/extbans/textban.c +++ b/src/modules/extbans/textban.c @@ -81,8 +81,8 @@ ModuleHeader MOD_HEADER /* Forward declarations */ char *extban_modeT_conv_param(char *para_in); -int extban_modeT_is_banned(Client *client, Channel *chptr, char *ban, int type, char **msg, char **errmsg); -int extban_modeT_is_ok(Client *client, Channel *chptr, char *para, int checkt, int what, int what2); +int extban_modeT_is_banned(Client *client, Channel *channel, char *ban, int type, char **msg, char **errmsg); +int extban_modeT_is_ok(Client *client, Channel *channel, char *para, int checkt, int what, int what2); void parse_word(const char *s, char **word, int *type); MOD_INIT() @@ -242,22 +242,22 @@ int textban_replace(int type, char *badword, char *line, char *buf) } #endif -unsigned int counttextbans(Channel *chptr) +unsigned int counttextbans(Channel *channel) { Ban *ban; unsigned int cnt = 0; - for (ban = chptr->banlist; ban; ban=ban->next) + for (ban = channel->banlist; ban; ban=ban->next) if ((ban->banstr[0] == '~') && (ban->banstr[1] == 'T') && (ban->banstr[2] == ':')) cnt++; - for (ban = chptr->exlist; ban; ban=ban->next) + for (ban = channel->exlist; ban; ban=ban->next) if ((ban->banstr[0] == '~') && (ban->banstr[1] == 'T') && (ban->banstr[2] == ':')) cnt++; return cnt; } -int extban_modeT_is_ok(Client *client, Channel *chptr, char *para, int checkt, int what, int what2) +int extban_modeT_is_ok(Client *client, Channel *channel, char *para, int checkt, int what, int what2) { int n; @@ -267,10 +267,10 @@ int extban_modeT_is_ok(Client *client, Channel *chptr, char *para, int checkt, i /* We check the # of bans in the channel, may not exceed MAX_EXTBANT_PER_CHAN */ if ((what == MODE_ADD) && (checkt == EXBCHK_PARAM) && MyUser(client) && !IsOper(client) && - ((n = counttextbans(chptr)) >= MAX_EXTBANT_PER_CHAN)) + ((n = counttextbans(channel)) >= MAX_EXTBANT_PER_CHAN)) { /* We check the # of bans in the channel, may not exceed MAX_EXTBANT_PER_CHAN */ - sendnumeric(client, ERR_BANLISTFULL, chptr->chname, para); + sendnumeric(client, ERR_BANLISTFULL, channel->chname, para); sendnotice(client, "Too many textbans for this channel"); return 0; } @@ -382,7 +382,7 @@ char *extban_modeT_conv_param(char *para_in) return retbuf; } -int extban_modeT_is_banned(Client *client, Channel *chptr, char *ban, int checktype, char **msg, char **errmsg) +int extban_modeT_is_banned(Client *client, Channel *channel, char *ban, int checktype, char **msg, char **errmsg) { static char filtered[512]; /* temp buffer */ long fl; @@ -450,7 +450,7 @@ int extban_modeT_is_banned(Client *client, Channel *chptr, char *ban, int checkt gettimeofday(&tv_beta, NULL); ircd_log(LOG_ERROR, "TextBan Timing: %ld microseconds (%s / %s / %d)", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec), - client->name, chptr->chname, strlen(*msg)); + client->name, channel->chname, strlen(*msg)); #endif if (cleaned) diff --git a/src/modules/extbans/timedban.c b/src/modules/extbans/timedban.c index 5081c0957..ae9b8190a 100644 --- a/src/modules/extbans/timedban.c +++ b/src/modules/extbans/timedban.c @@ -56,9 +56,9 @@ ModuleHeader MOD_HEADER /* Forward declarations */ char *timedban_extban_conv_param(char *para_in); -int timedban_extban_is_ok(Client* client, Channel* chptr, char* para_in, int checkt, int what, int what2); -int timedban_is_banned(Client *client, Channel *chptr, char *ban, int chktype, char **msg, char **errmsg); -void add_send_mode_param(Channel *chptr, Client *from, char what, char mode, char *param); +int timedban_extban_is_ok(Client* client, Channel* channel, char* para_in, int checkt, int what, int what2); +int timedban_is_banned(Client *client, Channel *channel, char *ban, int chktype, char **msg, char **errmsg); +void add_send_mode_param(Channel *channel, Client *from, char what, char mode, char *param); char *timedban_chanmsg(Client *, Client *, Channel *, char *, int); EVENT(timedban_timeout); @@ -226,7 +226,7 @@ int timedban_extban_syntax(Client *client, int checkt, char *reason) } /** Generic helper for sub-bans, used by our "is this ban ok?" function */ -int generic_ban_is_ok(Client *client, Channel *chptr, char *mask, int checkt, int what, int what2) +int generic_ban_is_ok(Client *client, Channel *channel, char *mask, int checkt, int what, int what2) { if ((mask[0] == '~') && MyUser(client)) { @@ -256,24 +256,24 @@ int generic_ban_is_ok(Client *client, Channel *chptr, char *mask, int checkt, in p = findmod_by_bantype(mask[1]); if (checkt == EXBCHK_ACCESS) { - if (p && p->is_ok && !p->is_ok(client, chptr, mask, EXBCHK_ACCESS, what, what2) && - !ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,chptr,NULL)) + if (p && p->is_ok && !p->is_ok(client, channel, mask, EXBCHK_ACCESS, what, what2) && + !ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,channel,NULL)) { return 0; /* REJECT */ } } else if (checkt == EXBCHK_ACCESS_ERR) { - if (p && p->is_ok && !p->is_ok(client, chptr, mask, EXBCHK_ACCESS, what, what2) && - !ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,chptr,NULL)) + if (p && p->is_ok && !p->is_ok(client, channel, mask, EXBCHK_ACCESS, what, what2) && + !ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,channel,NULL)) { - p->is_ok(client, chptr, mask, EXBCHK_ACCESS_ERR, what, what2); + p->is_ok(client, channel, mask, EXBCHK_ACCESS_ERR, what, what2); return 0; /* REJECT */ } } else if (checkt == EXBCHK_PARAM) { - if (p && p->is_ok && !p->is_ok(client, chptr, mask, EXBCHK_PARAM, what, what2)) + if (p && p->is_ok && !p->is_ok(client, channel, mask, EXBCHK_PARAM, what, what2)) { return 0; /* REJECT */ } @@ -290,7 +290,7 @@ int generic_ban_is_ok(Client *client, Channel *chptr, char *mask, int checkt, in } /** Validate ban ("is this ban ok?") */ -int timedban_extban_is_ok(Client* client, Channel* chptr, char* para_in, int checkt, int what, int what2) +int timedban_extban_is_ok(Client* client, Channel* channel, char* para_in, int checkt, int what, int what2) { char para[MAX_LENGTH+1]; char tmpmask[MAX_LENGTH+1]; @@ -327,8 +327,8 @@ int timedban_extban_is_ok(Client* client, Channel* chptr, char* para_in, int che strlcpy(tmpmask, matchby, sizeof(tmpmask)); timedban_extban_is_ok_recursion++; - //res = extban_is_ok_nuh_extban(client, chptr, tmpmask, checkt, what, what2); - res = generic_ban_is_ok(client, chptr, tmpmask, checkt, what, what2); + //res = extban_is_ok_nuh_extban(client, channel, tmpmask, checkt, what, what2); + res = generic_ban_is_ok(client, channel, tmpmask, checkt, what, what2); timedban_extban_is_ok_recursion--; if (res == 0) { @@ -343,7 +343,7 @@ int timedban_extban_is_ok(Client* client, Channel* chptr, char* para_in, int che } /** Check if the user is currently banned */ -int timedban_is_banned(Client *client, Channel *chptr, char *ban, int chktype, char **msg, char **errmsg) +int timedban_is_banned(Client *client, Channel *channel, char *ban, int chktype, char **msg, char **errmsg) { if (strncmp(ban, "~t:", 3)) return 0; /* not for us */ @@ -352,7 +352,7 @@ int timedban_is_banned(Client *client, Channel *chptr, char *ban, int chktype, c return 0; /* invalid fmt */ ban++; - return ban_check_mask(client, chptr, ban, chktype, msg, errmsg, 0); + return ban_check_mask(client, channel, ban, chktype, msg, errmsg, 0); } /** Helper to check if the ban has been expired */ @@ -385,58 +385,58 @@ static char pbuf[512]; /** This removes any expired timedbans */ EVENT(timedban_timeout) { - Channel *chptr; + Channel *channel; Ban *ban, *nextban; static int current_iteration = 0; if (++current_iteration >= TIMEDBAN_TIMER_ITERATION_SPLIT) current_iteration = 0; - for (chptr = channels; chptr; chptr = chptr->nextch) + for (channel = channels; channel; channel = channel->nextch) { /* This is a very quick check, at the cost of it being * biased since there's always a tendency of more channel * names to start with one specific letter. But hashing * is too costly. So we stick with this. It should be - * good enough. Alternative would be some chptr->id value. + * good enough. Alternative would be some channel->id value. */ - if (((unsigned int)chptr->chname[1] % TIMEDBAN_TIMER_ITERATION_SPLIT) != current_iteration) + if (((unsigned int)channel->chname[1] % TIMEDBAN_TIMER_ITERATION_SPLIT) != current_iteration) continue; /* not this time, maybe next */ *mbuf = *pbuf = '\0'; - for (ban = chptr->banlist; ban; ban=nextban) + for (ban = channel->banlist; ban; ban=nextban) { nextban = ban->next; if (!strncmp(ban->banstr, "~t:", 3) && timedban_has_ban_expired(ban)) { - add_send_mode_param(chptr, &me, '-', 'b', ban->banstr); - del_listmode(&chptr->banlist, chptr, ban->banstr); + add_send_mode_param(channel, &me, '-', 'b', ban->banstr); + del_listmode(&channel->banlist, channel, ban->banstr); } } - for (ban = chptr->exlist; ban; ban=nextban) + for (ban = channel->exlist; ban; ban=nextban) { nextban = ban->next; if (!strncmp(ban->banstr, "~t:", 3) && timedban_has_ban_expired(ban)) { - add_send_mode_param(chptr, &me, '-', 'e', ban->banstr); - del_listmode(&chptr->exlist, chptr, ban->banstr); + add_send_mode_param(channel, &me, '-', 'e', ban->banstr); + del_listmode(&channel->exlist, channel, ban->banstr); } } - for (ban = chptr->invexlist; ban; ban=nextban) + for (ban = channel->invexlist; ban; ban=nextban) { nextban = ban->next; if (!strncmp(ban->banstr, "~t:", 3) && timedban_has_ban_expired(ban)) { - add_send_mode_param(chptr, &me, '-', 'I', ban->banstr); - del_listmode(&chptr->invexlist, chptr, ban->banstr); + add_send_mode_param(channel, &me, '-', 'I', ban->banstr); + del_listmode(&channel->invexlist, channel, ban->banstr); } } if (*pbuf) { MessageTag *mtags = NULL; new_message(&me, NULL, &mtags); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, chptr->chname, mbuf, pbuf); - sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.name, chptr->chname, mbuf, pbuf); + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->chname, mbuf, pbuf); + sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.name, channel->chname, mbuf, pbuf); free_message_tags(mtags); *pbuf = 0; } @@ -447,7 +447,7 @@ EVENT(timedban_timeout) #error "add_send_mode_param() is not made for MODEBUFLEN > 512" #endif -void add_send_mode_param(Channel *chptr, Client *from, char what, char mode, char *param) { +void add_send_mode_param(Channel *channel, Client *from, char what, char mode, char *param) { static char *modes = NULL, lastwhat; static short count = 0; short send = 0; @@ -486,8 +486,8 @@ void add_send_mode_param(Channel *chptr, Client *from, char what, char mode, cha MessageTag *mtags = NULL; new_message(&me, NULL, &mtags); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, chptr->chname, mbuf, pbuf); - sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.name, chptr->chname, mbuf, pbuf); + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->chname, mbuf, pbuf); + sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.name, channel->chname, mbuf, pbuf); free_message_tags(mtags); send = 0; *pbuf = 0; diff --git a/src/modules/invite.c b/src/modules/invite.c index ef8a9d16e..a8c0ad1de 100644 --- a/src/modules/invite.c +++ b/src/modules/invite.c @@ -60,7 +60,7 @@ void send_invite_list(Client *client) for (inv = client->user->invited; inv; inv = inv->next) { sendnumeric(client, RPL_INVITELIST, - inv->value.chptr->chname); + inv->value.channel->chname); } sendnumeric(client, RPL_ENDOFINVITELIST); } @@ -73,7 +73,7 @@ void send_invite_list(Client *client) CMD_FUNC(cmd_invite) { Client *target; - Channel *chptr; + Channel *channel; int override = 0; int i = 0; Hook *h; @@ -96,7 +96,7 @@ CMD_FUNC(cmd_invite) if (MyConnect(client)) clean_channelname(parv[2]); - if (!(chptr = find_channel(parv[2], NULL))) + if (!(channel = find_channel(parv[2], NULL))) { sendnumeric(client, ERR_NOSUCHCHANNEL, parv[2]); return; @@ -104,16 +104,16 @@ CMD_FUNC(cmd_invite) for (h = Hooks[HOOKTYPE_PRE_INVITE]; h; h = h->next) { - i = (*(h->func.intfunc))(client,target,chptr,&override); + i = (*(h->func.intfunc))(client,target,channel,&override); if (i == HOOK_DENY) return; if (i == HOOK_ALLOW) break; } - if (!IsMember(client, chptr) && !IsULine(client)) + if (!IsMember(client, channel) && !IsULine(client)) { - if (ValidatePermissionsForPath("channel:override:invite:notinchannel",client,NULL,chptr,NULL) && client == target) + if (ValidatePermissionsForPath("channel:override:invite:notinchannel",client,NULL,channel,NULL) && client == target) { override = 1; } else { @@ -122,41 +122,41 @@ CMD_FUNC(cmd_invite) } } - if (IsMember(target, chptr)) + if (IsMember(target, channel)) { sendnumeric(client, ERR_USERONCHANNEL, parv[1], parv[2]); return; } - if (chptr->mode.mode & MODE_INVITEONLY) + if (channel->mode.mode & MODE_INVITEONLY) { - if (!is_chan_op(client, chptr) && !IsULine(client)) + if (!is_chan_op(client, channel) && !IsULine(client)) { - if (ValidatePermissionsForPath("channel:override:invite:invite-only",client,NULL,chptr,NULL) && client == target) + if (ValidatePermissionsForPath("channel:override:invite:invite-only",client,NULL,channel,NULL) && client == target) { override = 1; } else { - sendnumeric(client, ERR_CHANOPRIVSNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname); return; } } - else if (!IsMember(client, chptr) && !IsULine(client)) + else if (!IsMember(client, channel) && !IsULine(client)) { - if (ValidatePermissionsForPath("channel:override:invite:invite-only",client,NULL,chptr,NULL) && client == target) + if (ValidatePermissionsForPath("channel:override:invite:invite-only",client,NULL,channel,NULL) && client == target) { override = 1; } else { - sendnumeric(client, ERR_CHANOPRIVSNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname); return; } } } if (SPAMFILTER_VIRUSCHANDENY && SPAMFILTER_VIRUSCHAN && - !strcasecmp(chptr->chname, SPAMFILTER_VIRUSCHAN) && - !is_chan_op(client, chptr) && !ValidatePermissionsForPath("immune:server-ban:viruschan",client,NULL,NULL,NULL)) + !strcasecmp(channel->chname, SPAMFILTER_VIRUSCHAN) && + !is_chan_op(client, channel) && !ValidatePermissionsForPath("immune:server-ban:viruschan",client,NULL,NULL,NULL)) { - sendnumeric(client, ERR_CHANOPRIVSNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname); return; } @@ -183,7 +183,7 @@ CMD_FUNC(cmd_invite) if (!override) { - sendnumeric(client, RPL_INVITING, target->name, chptr->chname); + sendnumeric(client, RPL_INVITING, target->name, channel->chname); if (target->user->away) { sendnumeric(client, RPL_AWAY, target->name, target->user->away); @@ -194,63 +194,63 @@ CMD_FUNC(cmd_invite) /* Send OperOverride messages */ if (override && MyConnect(target)) { - if (is_banned(client, chptr, BANCHK_JOIN, NULL, NULL)) + if (is_banned(client, channel, BANCHK_JOIN, NULL, NULL)) { sendto_snomask_global(SNO_EYES, "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +b).", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); /* Logging implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Ban).", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); } - else if (chptr->mode.mode & MODE_INVITEONLY) + else if (channel->mode.mode & MODE_INVITEONLY) { sendto_snomask_global(SNO_EYES, "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +i).", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); /* Logging implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Invite Only)", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); } - else if (chptr->mode.limit) + else if (channel->mode.limit) { sendto_snomask_global(SNO_EYES, "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +l).", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); /* Logging implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Limit)", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); } - else if (*chptr->mode.key) + else if (*channel->mode.key) { sendto_snomask_global(SNO_EYES, "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +k).", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); /* Logging implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Key)", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); } - else if (has_channel_mode(chptr, 'z')) + else if (has_channel_mode(channel, 'z')) { sendto_snomask_global(SNO_EYES, "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +z).", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); /* Logging implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding SSL/TLS-Only)", - client->name, client->user->username, client->user->realhost, chptr->chname); + client->name, client->user->username, client->user->realhost, channel->chname); } #ifdef OPEROVERRIDE_VERIFY - else if (chptr->mode.mode & MODE_SECRET || chptr->mode.mode & MODE_PRIVATE) + else if (channel->mode.mode & MODE_SECRET || channel->mode.mode & MODE_PRIVATE) override = -1; #endif else @@ -260,9 +260,9 @@ CMD_FUNC(cmd_invite) if (MyConnect(target)) { if (IsUser(client) - && (is_chan_op(client, chptr) + && (is_chan_op(client, channel) || IsULine(client) - || ValidatePermissionsForPath("channel:override:invite:self",client,NULL,chptr,NULL) + || ValidatePermissionsForPath("channel:override:invite:self",client,NULL,channel,NULL) )) { MessageTag *mtags = NULL; @@ -270,19 +270,19 @@ CMD_FUNC(cmd_invite) new_message(&me, NULL, &mtags); if (override == 1) { - sendto_channel(chptr, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, + sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, 0, SEND_ALL, mtags, ":%s NOTICE @%s :OperOverride -- %s invited him/herself into the channel.", - me.name, chptr->chname, client->name); + me.name, channel->chname, client->name); } else if (override == 0) { - sendto_channel(chptr, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, + sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, 0, SEND_ALL, mtags, ":%s NOTICE @%s :%s invited %s into the channel.", - me.name, chptr->chname, client->name, target->name); + me.name, channel->chname, client->name, target->name); } - add_invite(client, target, chptr, mtags); + add_invite(client, target, channel, mtags); free_message_tags(mtags); } } @@ -291,6 +291,6 @@ CMD_FUNC(cmd_invite) if (!is_silenced(client, target)) { sendto_prefix_one(target, client, NULL, ":%s INVITE %s :%s", client->name, - target->name, ((chptr) ? (chptr->chname) : parv[2])); + target->name, ((channel) ? (channel->chname) : parv[2])); } } diff --git a/src/modules/join.c b/src/modules/join.c index 85baa1bb5..5a1e67602 100644 --- a/src/modules/join.c +++ b/src/modules/join.c @@ -24,16 +24,16 @@ /* Forward declarations */ CMD_FUNC(cmd_join); -void _join_channel(Channel *chptr, Client *client, MessageTag *mtags, int flags); +void _join_channel(Channel *channel, Client *client, MessageTag *mtags, int flags); void _do_join(Client *client, int parc, char *parv[]); -int _can_join(Client *client, Channel *chptr, char *key, char *parv[]); +int _can_join(Client *client, Channel *channel, char *key, char *parv[]); void _userhost_save_current(Client *client); void _userhost_changed(Client *client); -void _send_join_to_local_users(Client *client, Channel *chptr, MessageTag *mtags); +void _send_join_to_local_users(Client *client, Channel *channel, MessageTag *mtags); /* Externs */ extern MODVAR int spamf_ugly_vchanoverride; -extern int find_invex(Channel *chptr, Client *client); +extern int find_invex(Channel *channel, Client *client); /* Local vars */ static int bouncedtimes = 0; @@ -87,7 +87,7 @@ MOD_UNLOAD() * (eg: bans at the end), so don't change it unless you have a good reason * to do so -- Syzop. */ -int _can_join(Client *client, Channel *chptr, char *key, char *parv[]) +int _can_join(Client *client, Channel *channel, char *key, char *parv[]) { Link *lp; Ban *banned; @@ -96,34 +96,34 @@ int _can_join(Client *client, Channel *chptr, char *key, char *parv[]) for (h = Hooks[HOOKTYPE_CAN_JOIN]; h; h = h->next) { - i = (*(h->func.intfunc))(client,chptr,key,parv); + i = (*(h->func.intfunc))(client,channel,key,parv); if (i != 0) return i; } for (h = Hooks[HOOKTYPE_OPER_INVITE_BAN]; h; h = h->next) { - j = (*(h->func.intfunc))(client,chptr); + j = (*(h->func.intfunc))(client,channel); if (j != 0) break; } /* See if we can evade this ban */ - banned = is_banned(client, chptr, BANCHK_JOIN, NULL, NULL); + banned = is_banned(client, channel, BANCHK_JOIN, NULL, NULL); if (banned && j == HOOK_DENY) return (ERR_BANNEDFROMCHAN); for (lp = client->user->invited; lp; lp = lp->next) - if (lp->value.chptr == chptr) + if (lp->value.channel == channel) return 0; - if (chptr->users >= chptr->mode.limit) + if (channel->users >= channel->mode.limit) { /* Hmmm.. don't really like this.. and not at this place */ for (h = Hooks[HOOKTYPE_CAN_JOIN_LIMITEXCEEDED]; h; h = h->next) { - i = (*(h->func.intfunc))(client,chptr,key,parv); + i = (*(h->func.intfunc))(client,channel,key,parv); if (i != 0) return i; } @@ -132,13 +132,13 @@ int _can_join(Client *client, Channel *chptr, char *key, char *parv[]) } - if (*chptr->mode.key && (BadPtr(key) || strcmp(chptr->mode.key, key))) + if (*channel->mode.key && (BadPtr(key) || strcmp(channel->mode.key, key))) return (ERR_BADCHANNELKEY); - if ((chptr->mode.mode & MODE_INVITEONLY) && !find_invex(chptr, client)) + if ((channel->mode.mode & MODE_INVITEONLY) && !find_invex(channel, client)) return (ERR_INVITEONLYCHAN); - if ((chptr->mode.limit && chptr->users >= chptr->mode.limit)) + if ((channel->mode.limit && channel->users >= channel->mode.limit)) return (ERR_CHANNELISFULL); if (banned) @@ -146,8 +146,8 @@ int _can_join(Client *client, Channel *chptr, char *key, char *parv[]) #ifndef NO_OPEROVERRIDE #ifdef OPEROVERRIDE_VERIFY - if (ValidatePermissionsForPath("channel:override:privsecret",client,NULL,chptr,NULL) && (chptr->mode.mode & MODE_SECRET || - chptr->mode.mode & MODE_PRIVATE) && !is_autojoin_chan(chptr->chname)) + if (ValidatePermissionsForPath("channel:override:privsecret",client,NULL,channel,NULL) && (channel->mode.mode & MODE_SECRET || + channel->mode.mode & MODE_PRIVATE) && !is_autojoin_chan(channel->chname)) return (ERR_OPERSPVERIFY); #endif #endif @@ -180,13 +180,13 @@ CMD_FUNC(cmd_join) bouncedtimes = 0; } -/** Send JOIN message for 'client' to all users in 'chptr'. - * Taking into account that not everyone in chptr should see the JOIN (mode +D) +/** Send JOIN message for 'client' to all users in 'channel'. + * Taking into account that not everyone in channel should see the JOIN (mode +D) * and taking into account the different types of JOIN (due to CAP extended-join). */ -void _send_join_to_local_users(Client *client, Channel *chptr, MessageTag *mtags) +void _send_join_to_local_users(Client *client, Channel *channel, MessageTag *mtags) { - int chanops_only = invisible_user_in_channel(client, chptr); + int chanops_only = invisible_user_in_channel(client, channel); Member *lp; Client *acptr; char joinbuf[512]; @@ -195,14 +195,14 @@ void _send_join_to_local_users(Client *client, Channel *chptr, MessageTag *mtags long CAP_AWAY_NOTIFY = ClientCapabilityBit("away-notify"); ircsnprintf(joinbuf, sizeof(joinbuf), ":%s!%s@%s JOIN :%s", - client->name, client->user->username, GetHost(client), chptr->chname); + client->name, client->user->username, GetHost(client), channel->chname); ircsnprintf(exjoinbuf, sizeof(exjoinbuf), ":%s!%s@%s JOIN %s %s :%s", - client->name, client->user->username, GetHost(client), chptr->chname, + client->name, client->user->username, GetHost(client), channel->chname, !isdigit(*client->user->svid) ? client->user->svid : "*", client->info); - for (lp = chptr->members; lp; lp = lp->next) + for (lp = channel->members; lp; lp = lp->next) { acptr = lp->client; @@ -231,33 +231,33 @@ void _send_join_to_local_users(Client *client, Channel *chptr, MessageTag *mtags /* Routine that actually makes a user join the channel * this does no actual checking (banned, etc.) it just adds the user */ -void _join_channel(Channel *chptr, Client *client, MessageTag *recv_mtags, int flags) +void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int flags) { MessageTag *mtags = NULL; /** Message tags to send to local users (sender is :user) */ MessageTag *mtags_sjoin = NULL; /* Message tags to send to remote servers for SJOIN (sender is :me.name) */ char *parv[] = { 0, 0 }; /* Same way as in SJOIN */ - new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, chptr->chname); + new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->chname); new_message(&me, recv_mtags, &mtags_sjoin); - add_user_to_channel(chptr, client, flags); + add_user_to_channel(channel, client, flags); - send_join_to_local_users(client, chptr, mtags); + send_join_to_local_users(client, channel, mtags); /* old non-SJOINv3 servers */ - sendto_server(client, 0, PROTO_SJ3, mtags, ":%s JOIN :%s", client->name, chptr->chname); + sendto_server(client, 0, PROTO_SJ3, mtags, ":%s JOIN :%s", client->name, channel->chname); /* I _know_ that the "@%s " look a bit wierd with the space and all .. but its to get around a SJOIN bug --stskeeps */ sendto_server(client, PROTO_SID | PROTO_SJ3, 0, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ", - me.id, (long long)chptr->creationtime, - chptr->chname, chfl_to_sjoin_symbol(flags), ID(client)); + me.id, (long long)channel->creationtime, + channel->chname, chfl_to_sjoin_symbol(flags), ID(client)); sendto_server(client, PROTO_SJ3, PROTO_SID, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ", - me.name, (long long)chptr->creationtime, - chptr->chname, chfl_to_sjoin_symbol(flags), client->name); + me.name, (long long)channel->creationtime, + channel->chname, chfl_to_sjoin_symbol(flags), client->name); if (MyUser(client)) { @@ -266,13 +266,13 @@ void _join_channel(Channel *chptr, Client *client, MessageTag *recv_mtags, int f ** during a net.reconnect : between remote join and ** the mode with TS. --Run */ - if (chptr->creationtime == 0) + if (channel->creationtime == 0) { - chptr->creationtime = TStime(); + channel->creationtime = TStime(); sendto_server(client, 0, 0, NULL, ":%s MODE %s + %lld", - me.name, chptr->chname, (long long)chptr->creationtime); + me.name, channel->chname, (long long)channel->creationtime); } - del_invite(client, chptr); + del_invite(client, channel); if (flags && !(flags & CHFL_DEOPPED)) { /* We could generate mtags here but this is only for @@ -285,66 +285,66 @@ void _join_channel(Channel *chptr, Client *client, MessageTag *recv_mtags, int f /* +ao / +qo for when PREFIX_AQ is off */ sendto_server(client, 0, PROTO_SJ3, NULL, ":%s MODE %s +o%c %s %s %lld", me.name, - chptr->chname, chfl_to_chanmode(flags), client->name, client->name, - (long long)chptr->creationtime); + channel->chname, chfl_to_chanmode(flags), client->name, client->name, + (long long)channel->creationtime); } else { #endif /* +v/+h/+o (and +a/+q if PREFIX_AQ is on) */ sendto_server(client, 0, PROTO_SJ3, NULL, ":%s MODE %s +%c %s %lld", me.name, - chptr->chname, chfl_to_chanmode(flags), client->name, - (long long)chptr->creationtime); + channel->chname, chfl_to_chanmode(flags), client->name, + (long long)channel->creationtime); #ifndef PREFIX_AQ } #endif } - if (chptr->topic) + if (channel->topic) { - sendnumeric(client, RPL_TOPIC, chptr->chname, chptr->topic); - sendnumeric(client, RPL_TOPICWHOTIME, chptr->chname, chptr->topic_nick, - chptr->topic_time); + sendnumeric(client, RPL_TOPIC, channel->chname, channel->topic); + sendnumeric(client, RPL_TOPICWHOTIME, channel->chname, channel->topic_nick, + channel->topic_time); } /* Set default channel modes (set::modes-on-join). * Set only if it's the 1st user and only if no other modes have been set * already (eg: +P, permanent). */ - if ((chptr->users == 1) && !chptr->mode.mode && !chptr->mode.extmode && + if ((channel->users == 1) && !channel->mode.mode && !channel->mode.extmode && (MODES_ON_JOIN || iConf.modes_on_join.extmodes)) { int i; MessageTag *mtags_mode = NULL; - chptr->mode.extmode = iConf.modes_on_join.extmodes; + channel->mode.extmode = iConf.modes_on_join.extmodes; /* Param fun */ for (i = 0; i <= Channelmode_highest; i++) { if (!Channelmode_Table[i].flag || !Channelmode_Table[i].paracount) continue; - if (chptr->mode.extmode & Channelmode_Table[i].mode) - cm_putparameter(chptr, Channelmode_Table[i].flag, iConf.modes_on_join.extparams[i]); + if (channel->mode.extmode & Channelmode_Table[i].mode) + cm_putparameter(channel, Channelmode_Table[i].flag, iConf.modes_on_join.extparams[i]); } - chptr->mode.mode = MODES_ON_JOIN; + channel->mode.mode = MODES_ON_JOIN; *modebuf = *parabuf = 0; - channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr); + channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel); /* This should probably be in the SJOIN stuff */ - new_message_special(&me, recv_mtags, &mtags_mode, ":%s MODE %s %s %s", me.name, chptr->chname, modebuf, parabuf); + new_message_special(&me, recv_mtags, &mtags_mode, ":%s MODE %s %s %s", me.name, channel->chname, modebuf, parabuf); sendto_server(&me, 0, 0, mtags_mode, ":%s MODE %s %s %s %lld", - me.name, chptr->chname, modebuf, parabuf, (long long)chptr->creationtime); - sendto_one(client, mtags_mode, ":%s MODE %s %s %s", me.name, chptr->chname, modebuf, parabuf); + me.name, channel->chname, modebuf, parabuf, (long long)channel->creationtime); + sendto_one(client, mtags_mode, ":%s MODE %s %s %s", me.name, channel->chname, modebuf, parabuf); free_message_tags(mtags_mode); } parv[0] = client->name; - parv[1] = chptr->chname; + parv[1] = channel->chname; (void)do_cmd(client, NULL, "NAMES", 2, parv); - RunHook4(HOOKTYPE_LOCAL_JOIN, client, chptr, mtags, parv); + RunHook4(HOOKTYPE_LOCAL_JOIN, client, channel, mtags, parv); } else { - RunHook4(HOOKTYPE_REMOTE_JOIN, client, chptr, mtags, parv); + RunHook4(HOOKTYPE_REMOTE_JOIN, client, channel, mtags, parv); } free_message_tags(mtags); @@ -362,7 +362,7 @@ void _do_join(Client *client, int parc, char *parv[]) { char jbuf[BUFSIZE]; Membership *lp; - Channel *chptr; + Channel *channel; char *name, *key = NULL; int i, flags = 0, ishold; char *p = NULL, *p2 = NULL; @@ -458,19 +458,19 @@ void _do_join(Client *client, int parc, char *parv[]) while ((lp = client->user->channel)) { MessageTag *mtags = NULL; - chptr = lp->chptr; + channel = lp->channel; new_message(client, NULL, &mtags); - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, NULL, + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, NULL, ":%s PART %s :%s", - client->name, chptr->chname, "Left all channels"); - sendto_server(client, 0, 0, mtags, ":%s PART %s :Left all channels", client->name, chptr->chname); + client->name, channel->chname, "Left all channels"); + sendto_server(client, 0, 0, mtags, ":%s PART %s :Left all channels", client->name, channel->chname); if (MyConnect(client)) - RunHook4(HOOKTYPE_LOCAL_PART, client, chptr, mtags, "Left all channels"); + RunHook4(HOOKTYPE_LOCAL_PART, client, channel, mtags, "Left all channels"); - remove_user_from_channel(client, chptr); + remove_user_from_channel(client, channel); free_message_tags(mtags); } continue; @@ -538,12 +538,12 @@ void _do_join(Client *client, int parc, char *parv[]) { int invited = 0; Link *lp; - Channel *chptr = find_channel(name, NULL); + Channel *channel = find_channel(name, NULL); - if (chptr) + if (channel) { for (lp = client->user->invited; lp; lp = lp->next) - if (lp->value.chptr == chptr) + if (lp->value.channel == channel) invited = 1; } if (!invited) @@ -555,11 +555,11 @@ void _do_join(Client *client, int parc, char *parv[]) } } - chptr = get_channel(client, name, CREATE); - if (chptr && (lp = find_membership_link(client->user->channel, chptr))) + channel = get_channel(client, name, CREATE); + if (channel && (lp = find_membership_link(client->user->channel, channel))) continue; - if (!chptr) + if (!channel) continue; i = HOOK_CONTINUE; @@ -570,7 +570,7 @@ void _do_join(Client *client, int parc, char *parv[]) Hook *h; for (h = Hooks[HOOKTYPE_PRE_LOCAL_JOIN]; h; h = h->next) { - i = (*(h->func.intfunc))(client,chptr,parv); + i = (*(h->func.intfunc))(client,channel,parv); if (i == HOOK_DENY || i == HOOK_ALLOW) break; } @@ -578,13 +578,13 @@ void _do_join(Client *client, int parc, char *parv[]) if (i == HOOK_DENY) { /* Rejected... if we just created a new chan we should destroy it too. -- Syzop */ - if (!chptr->users) - sub1_from_channel(chptr); + if (!channel->users) + sub1_from_channel(channel); continue; } /* If they are allowed, don't check can_join */ if (i != HOOK_ALLOW && - (i = can_join(client, chptr, key, parv))) + (i = can_join(client, channel, key, parv))) { if (i != -1) { @@ -605,7 +605,7 @@ void _do_join(Client *client, int parc, char *parv[]) * and so on, each with their own unique msgid and such. */ new_message(client, NULL, &mtags); - join_channel(chptr, client, mtags, flags); + join_channel(channel, client, mtags, flags); free_message_tags(mtags); } RET() @@ -716,40 +716,40 @@ void _userhost_changed(Client *client) /* Walk through all channels of this user.. */ for (channels = client->user->channel; channels; channels = channels->next) { - Channel *chptr = channels->chptr; + Channel *channel = channels->channel; int flags = channels->flags; char *modes; char partbuf[512]; /* PART */ char joinbuf[512]; /* JOIN */ char exjoinbuf[512]; /* JOIN (for CAP extended-join) */ char modebuf[512]; /* MODE (if any) */ - int chanops_only = invisible_user_in_channel(client, chptr); + int chanops_only = invisible_user_in_channel(client, channel); modebuf[0] = '\0'; /* If the user is banned, don't send any rejoins, it would only be annoying */ - if (is_banned(client, chptr, BANCHK_JOIN, NULL, NULL)) + if (is_banned(client, channel, BANCHK_JOIN, NULL, NULL)) continue; /* Prepare buffers for PART, JOIN, MODE */ ircsnprintf(partbuf, sizeof(partbuf), ":%s!%s@%s PART %s :%s", remember_nick, remember_user, remember_host, - chptr->chname, + channel->chname, "Changing host"); ircsnprintf(joinbuf, sizeof(joinbuf), ":%s!%s@%s JOIN %s", - client->name, client->user->username, GetHost(client), chptr->chname); + client->name, client->user->username, GetHost(client), channel->chname); ircsnprintf(exjoinbuf, sizeof(exjoinbuf), ":%s!%s@%s JOIN %s %s :%s", - client->name, client->user->username, GetHost(client), chptr->chname, + client->name, client->user->username, GetHost(client), channel->chname, !isdigit(*client->user->svid) ? client->user->svid : "*", client->info); modes = get_chmodes_for_user(client, flags); if (!BadPtr(modes)) - ircsnprintf(modebuf, sizeof(modebuf), ":%s MODE %s %s", me.name, chptr->chname, modes); + ircsnprintf(modebuf, sizeof(modebuf), ":%s MODE %s %s", me.name, channel->chname, modes); - for (lp = chptr->members; lp; lp = lp->next) + for (lp = channel->members; lp; lp = lp->next) { acptr = lp->client; @@ -796,7 +796,7 @@ void _userhost_changed(Client *client) current_serial++; for (channels = client->user->channel; channels; channels = channels->next) { - for (lp = channels->chptr->members; lp; lp = lp->next) + for (lp = channels->channel->members; lp; lp = lp->next) { acptr = lp->client; if (MyUser(acptr) && HasCapabilityFast(acptr, CAP_CHGHOST) && diff --git a/src/modules/jointhrottle.c b/src/modules/jointhrottle.c index d9e5a8bdb..eb11cf7e1 100644 --- a/src/modules/jointhrottle.c +++ b/src/modules/jointhrottle.c @@ -58,12 +58,12 @@ struct JoinFlood { int jointhrottle_config_test(ConfigFile *, ConfigEntry *, int, int *); int jointhrottle_config_run(ConfigFile *, ConfigEntry *, int); void jointhrottle_md_free(ModData *m); -int jointhrottle_can_join(Client *client, Channel *chptr, char *key, char *parv[]); -int jointhrottle_local_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]); -static int isjthrottled(Client *client, Channel *chptr); -static void jointhrottle_increase_usercounter(Client *client, Channel *chptr); +int jointhrottle_can_join(Client *client, Channel *channel, char *key, char *parv[]); +int jointhrottle_local_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]); +static int isjthrottled(Client *client, Channel *channel); +static void jointhrottle_increase_usercounter(Client *client, Channel *channel); EVENT(jointhrottle_cleanup_structs); -JoinFlood *jointhrottle_addentry(Client *client, Channel *chptr); +JoinFlood *jointhrottle_addentry(Client *client, Channel *channel); MOD_TEST() { @@ -151,7 +151,7 @@ int jointhrottle_config_run(ConfigFile *cf, ConfigEntry *ce, int type) return 0; } -static int isjthrottled(Client *client, Channel *chptr) +static int isjthrottled(Client *client, Channel *channel) { JoinFlood *e; int num = cfg.num; @@ -162,7 +162,7 @@ static int isjthrottled(Client *client, Channel *chptr) /* Grab user<->chan entry.. */ for (e = moddata_local_client(client, jointhrottle_md).ptr; e; e=e->next) - if (!strcasecmp(e->chname, chptr->chname)) + if (!strcasecmp(e->chname, channel->chname)) break; if (!e) @@ -177,7 +177,7 @@ static int isjthrottled(Client *client, Channel *chptr) return 0; } -static void jointhrottle_increase_usercounter(Client *client, Channel *chptr) +static void jointhrottle_increase_usercounter(Client *client, Channel *channel) { JoinFlood *e; @@ -186,13 +186,13 @@ static void jointhrottle_increase_usercounter(Client *client, Channel *chptr) /* Grab user<->chan entry.. */ for (e = moddata_local_client(client, jointhrottle_md).ptr; e; e=e->next) - if (!strcasecmp(e->chname, chptr->chname)) + if (!strcasecmp(e->chname, channel->chname)) break; if (!e) { /* Allocate one */ - e = jointhrottle_addentry(client, chptr); + e = jointhrottle_addentry(client, channel); e->firstjoin = TStime(); e->numjoins = 1; } else @@ -206,24 +206,24 @@ static void jointhrottle_increase_usercounter(Client *client, Channel *chptr) } } -int jointhrottle_can_join(Client *client, Channel *chptr, char *key, char *parv[]) +int jointhrottle_can_join(Client *client, Channel *channel, char *key, char *parv[]) { - if (!ValidatePermissionsForPath("immune:join-flood",client,NULL,chptr,NULL) && isjthrottled(client, chptr)) + if (!ValidatePermissionsForPath("immune:join-flood",client,NULL,channel,NULL) && isjthrottled(client, channel)) return ERR_TOOMANYJOINS; return 0; } -int jointhrottle_local_join(Client *client, Channel *chptr, MessageTag *mtags, char *parv[]) +int jointhrottle_local_join(Client *client, Channel *channel, MessageTag *mtags, char *parv[]) { - jointhrottle_increase_usercounter(client, chptr); + jointhrottle_increase_usercounter(client, channel); return 0; } /** Adds a JoinFlood entry to user & channel and returns entry. * NOTE: Does not check for already-existing-entry */ -JoinFlood *jointhrottle_addentry(Client *client, Channel *chptr) +JoinFlood *jointhrottle_addentry(Client *client, Channel *channel) { JoinFlood *e; @@ -232,12 +232,12 @@ JoinFlood *jointhrottle_addentry(Client *client, Channel *chptr) abort(); for (e=moddata_local_client(client, jointhrottle_md).ptr; e; e=e->next) - if (!strcasecmp(e->chname, chptr->chname)) + if (!strcasecmp(e->chname, channel->chname)) abort(); /* already exists -- should never happen */ #endif e = safe_alloc(sizeof(JoinFlood)); - strlcpy(e->chname, chptr->chname, sizeof(e->chname)); + strlcpy(e->chname, channel->chname, sizeof(e->chname)); /* Insert our new entry as (new) head */ if (moddata_local_client(client, jointhrottle_md).ptr) diff --git a/src/modules/kick.c b/src/modules/kick.c index 1450dff86..3c2104dd9 100644 --- a/src/modules/kick.c +++ b/src/modules/kick.c @@ -68,7 +68,7 @@ MOD_UNLOAD() CMD_FUNC(cmd_kick) { Client *who; - Channel *chptr; + Channel *channel; int chasing = 0; char *comment, *name, *p = NULL, *user, *p2 = NULL, *badkick; Membership *lp; @@ -92,19 +92,19 @@ CMD_FUNC(cmd_kick) for (; (name = strtoken(&p, parv[1], ",")); parv[1] = NULL) { long client_flags = 0; - chptr = get_channel(client, name, !CREATE); - if (!chptr) + channel = get_channel(client, name, !CREATE); + if (!channel) { sendnumeric(client, ERR_NOSUCHCHANNEL, name); continue; } /* Store "client" access flags */ if (IsUser(client)) - client_flags = get_access(client, chptr); - if (MyUser(client) && !IsULine(client) && !op_can_override("channel:override:kick:no-ops",client,chptr,NULL) + client_flags = get_access(client, channel); + if (MyUser(client) && !IsULine(client) && !op_can_override("channel:override:kick:no-ops",client,channel,NULL) && !(client_flags & CHFL_ISOP) && !(client_flags & CHFL_HALFOP)) { - sendnumeric(client, ERR_CHANOPRIVSNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname); continue; } @@ -122,7 +122,7 @@ CMD_FUNC(cmd_kick) continue; /* No such user left! */ if (!who->user) continue; - if ((lp = find_membership_link(who->user->channel, chptr))) + if ((lp = find_membership_link(who->user->channel, channel))) { if (IsULine(client) || IsServer(client)) goto attack; @@ -135,12 +135,12 @@ CMD_FUNC(cmd_kick) */ /* Store "who" access flags */ - who_flags = get_access(who, chptr); + who_flags = get_access(who, channel); badkick = NULL; ret = EX_ALLOW; for (h = Hooks[HOOKTYPE_CAN_KICK]; h; h = h->next) { - int n = (*(h->func.intfunc))(client, who, chptr, comment, client_flags, who_flags, &badkick); + int n = (*(h->func.intfunc))(client, who, channel, comment, client_flags, who_flags, &badkick); if (n == EX_DENY) ret = n; @@ -163,15 +163,15 @@ CMD_FUNC(cmd_kick) if (ret == EX_DENY) { /* If set it means 'not allowed to kick'.. now check if (s)he can override that.. */ - if (op_can_override("channel:override:kick:no-ops",client,chptr,NULL)) + if (op_can_override("channel:override:kick:no-ops",client,channel,NULL)) { sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) KICK %s %s (%s)", client->name, client->user->username, client->user->realhost, - chptr->chname, who->name, comment); + channel->chname, who->name, comment); ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)", client->name, client->user->username, client->user->realhost, - chptr->chname, who->name, comment); + channel->chname, who->name, comment); goto attack; /* all other checks don't matter anymore (and could cause double msgs) */ } else { /* Not an oper overriding */ @@ -186,7 +186,7 @@ CMD_FUNC(cmd_kick) * we are +h but victim is +o, OR... * we are +h and victim is +h */ - if (op_can_override("channel:override:kick:no-ops",client,chptr,NULL)) + if (op_can_override("channel:override:kick:no-ops",client,channel,NULL)) { if ((!(client_flags & CHFL_ISOP) && !(client_flags & CHFL_HALFOP)) || ((client_flags & CHFL_HALFOP) && (who_flags & CHFL_ISOP)) || @@ -195,12 +195,12 @@ CMD_FUNC(cmd_kick) sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) KICK %s %s (%s)", client->name, client->user->username, client->user->realhost, - chptr->chname, who->name, comment); + channel->chname, who->name, comment); /* Logging Implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)", client->name, client->user->username, client->user->realhost, - chptr->chname, who->name, comment); + channel->chname, who->name, comment); goto attack; } /* is_chan_op */ @@ -211,17 +211,17 @@ CMD_FUNC(cmd_kick) && !(client_flags & CHFL_CHANOWNER)) { if (client == who) goto attack; /* kicking self == ok */ - if (op_can_override("channel:override:kick:owner",client,chptr,NULL)) /* (and f*ck local ops) */ + if (op_can_override("channel:override:kick:owner",client,channel,NULL)) /* (and f*ck local ops) */ { /* IRCop kicking owner/prot */ sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) KICK %s %s (%s)", client->name, client->user->username, client->user->realhost, - chptr->chname, who->name, comment); + channel->chname, who->name, comment); /* Logging Implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)", client->name, client->user->username, client->user->realhost, - chptr->chname, who->name, comment); + channel->chname, who->name, comment); goto attack; } @@ -273,7 +273,7 @@ CMD_FUNC(cmd_kick) int breakit = 0; Hook *h; for (h = Hooks[HOOKTYPE_PRE_LOCAL_KICK]; h; h = h->next) { - if((*(h->func.intfunc))(client,who,chptr,comment) > 0) { + if((*(h->func.intfunc))(client,who,channel,comment) > 0) { breakit = 1; break; } @@ -283,45 +283,45 @@ CMD_FUNC(cmd_kick) } mtags = NULL; - new_message_special(client, recv_mtags, &mtags, ":%s KICK %s %s", client->name, chptr->chname, who->name); + new_message_special(client, recv_mtags, &mtags, ":%s KICK %s %s", client->name, channel->chname, who->name); /* The same message is actually sent at 5 places below (though max 4 at most) */ if (MyUser(client)) - RunHook5(HOOKTYPE_LOCAL_KICK, client, who, chptr, mtags, comment); + RunHook5(HOOKTYPE_LOCAL_KICK, client, who, channel, mtags, comment); else - RunHook5(HOOKTYPE_REMOTE_KICK, client, who, chptr, mtags, comment); + RunHook5(HOOKTYPE_REMOTE_KICK, client, who, channel, mtags, comment); if (lp) { - if (invisible_user_in_channel(who, chptr)) + if (invisible_user_in_channel(who, channel)) { /* Send it only to chanops & victim */ - sendto_channel(chptr, client, who, + sendto_channel(channel, client, who, CHFL_HALFOP|CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN, 0, SEND_LOCAL, mtags, ":%s KICK %s %s :%s", - client->name, chptr->chname, who->name, comment); + client->name, channel->chname, who->name, comment); if (MyUser(who)) { sendto_prefix_one(who, client, mtags, ":%s KICK %s %s :%s", - client->name, chptr->chname, who->name, comment); + client->name, channel->chname, who->name, comment); } } else { /* NORMAL */ - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s KICK %s %s :%s", - client->name, chptr->chname, who->name, comment); + client->name, channel->chname, who->name, comment); } } sendto_server(client, PROTO_SID, 0, mtags, ":%s KICK %s %s :%s", - ID(client), chptr->chname, ID(who), comment); + ID(client), channel->chname, ID(who), comment); sendto_server(client, 0, PROTO_SID, mtags, ":%s KICK %s %s :%s", - client->name, chptr->chname, who->name, comment); + client->name, channel->chname, who->name, comment); free_message_tags(mtags); if (lp) { - remove_user_from_channel(who, chptr); + remove_user_from_channel(who, channel); } } else if (MyUser(client)) diff --git a/src/modules/knock.c b/src/modules/knock.c index 6443da7d5..122e4501e 100644 --- a/src/modules/knock.c +++ b/src/modules/knock.c @@ -65,7 +65,7 @@ MOD_UNLOAD() */ CMD_FUNC(cmd_knock) { - Channel *chptr; + Channel *channel; Hook *h; int i = 0; MessageTag *mtags = NULL; @@ -90,34 +90,34 @@ CMD_FUNC(cmd_knock) return; } - if (!(chptr = find_channel(parv[1], NULL))) + if (!(channel = find_channel(parv[1], NULL))) { sendnumeric(client, ERR_CANNOTKNOCK, parv[1], "Channel does not exist!"); return; } /* IsMember bugfix by codemastr */ - if (IsMember(client, chptr) == 1) + if (IsMember(client, channel) == 1) { - sendnumeric(client, ERR_CANNOTKNOCK, chptr->chname, "You're already there!"); + sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "You're already there!"); return; } - if (!(chptr->mode.mode & MODE_INVITEONLY)) + if (!(channel->mode.mode & MODE_INVITEONLY)) { - sendnumeric(client, ERR_CANNOTKNOCK, chptr->chname, "Channel is not invite only!"); + sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "Channel is not invite only!"); return; } - if (is_banned(client, chptr, BANCHK_JOIN, NULL, NULL)) + if (is_banned(client, channel, BANCHK_JOIN, NULL, NULL)) { - sendnumeric(client, ERR_CANNOTKNOCK, chptr->chname, "You're banned!"); + sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "You're banned!"); return; } for (h = Hooks[HOOKTYPE_PRE_KNOCK]; h; h = h->next) { - i = (*(h->func.intfunc))(client,chptr); + i = (*(h->func.intfunc))(client,channel); if (i == HOOK_DENY || i == HOOK_ALLOW) break; } @@ -143,16 +143,16 @@ CMD_FUNC(cmd_knock) } new_message(&me, NULL, &mtags); - sendto_channel(chptr, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, + sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, 0, SEND_ALL, mtags, ":%s NOTICE @%s :[Knock] by %s!%s@%s (%s)", - me.name, chptr->chname, + me.name, channel->chname, client->name, client->user->username, GetHost(client), parv[2] ? parv[2] : "no reason specified"); - sendnotice(client, "Knocked on %s", chptr->chname); + sendnotice(client, "Knocked on %s", channel->chname); - RunHook4(HOOKTYPE_KNOCK, client, chptr, mtags, parv[2]); + RunHook4(HOOKTYPE_KNOCK, client, channel, mtags, parv[2]); free_message_tags(mtags); } diff --git a/src/modules/list.c b/src/modules/list.c index 9ada163b6..bb0726938 100644 --- a/src/modules/list.c +++ b/src/modules/list.c @@ -113,7 +113,7 @@ MOD_UNLOAD() */ CMD_FUNC(cmd_list) { - Channel *chptr; + Channel *channel; time_t currenttime = TStime(); char *name, *p = NULL; ChannelListOptions *lopt = NULL; @@ -264,22 +264,22 @@ CMD_FUNC(cmd_list) } else /* Just a normal channel */ { - chptr = find_channel(name, NULL); - if (chptr && (ShowChannel(client, chptr) || ValidatePermissionsForPath("channel:see:list:secret",client,NULL,chptr,NULL))) { + channel = find_channel(name, NULL); + if (channel && (ShowChannel(client, channel) || ValidatePermissionsForPath("channel:see:list:secret",client,NULL,channel,NULL))) { #ifdef LIST_SHOW_MODES modebuf[0] = '['; - channel_modes(client, modebuf+1, parabuf, sizeof(modebuf)-1, sizeof(parabuf), chptr); + channel_modes(client, modebuf+1, parabuf, sizeof(modebuf)-1, sizeof(parabuf), channel); if (modebuf[2] == '\0') modebuf[0] = '\0'; else strlcat(modebuf, "]", sizeof modebuf); #endif sendnumeric(client, RPL_LIST, - name, chptr->users, + name, channel->users, #ifdef LIST_SHOW_MODES modebuf, #endif - (chptr->topic ? chptr->topic : + (channel->topic ? channel->topic : "")); } } @@ -314,7 +314,7 @@ CMD_FUNC(cmd_list) */ void send_list(Client *client) { - Channel *chptr; + Channel *channel; ChannelListOptions *lopt = CHANNELLISTOPTIONS(client); unsigned int hashnum; int numsend = (get_sendq(client) / 768) + 1; /* (was previously hard-coded) */ @@ -348,73 +348,73 @@ void send_list(Client *client) for (hashnum = lopt->starthash; hashnum < CHAN_HASH_TABLE_SIZE; hashnum++) { if (numsend > 0) - for (chptr = hash_get_chan_bucket(hashnum); - chptr; chptr = chptr->hnextch) + for (channel = hash_get_chan_bucket(hashnum); + channel; channel = channel->hnextch) { - if (SecretChannel(chptr) - && !IsMember(client, chptr) - && !ValidatePermissionsForPath("channel:see:list:secret",client,NULL,chptr,NULL)) + if (SecretChannel(channel) + && !IsMember(client, channel) + && !ValidatePermissionsForPath("channel:see:list:secret",client,NULL,channel,NULL)) continue; /* set::hide-list { deny-channel } */ - if (!IsOper(client) && iConf.hide_list && Find_channel_allowed(client, chptr->chname)) + if (!IsOper(client) && iConf.hide_list && Find_channel_allowed(client, channel->chname)) continue; /* Much more readable like this -- codemastr */ if ((!lopt->showall)) { /* User count must be in range */ - if ((chptr->users < lopt->usermin) || - ((lopt->usermax >= 0) && (chptr->users > + if ((channel->users < lopt->usermin) || + ((lopt->usermax >= 0) && (channel->users > lopt->usermax))) continue; /* Creation time must be in range */ - if ((chptr->creationtime && (chptr->creationtime < - lopt->chantimemin)) || (chptr->creationtime > + if ((channel->creationtime && (channel->creationtime < + lopt->chantimemin)) || (channel->creationtime > lopt->chantimemax)) continue; /* Topic time must be in range */ - if ((chptr->topic_time < lopt->topictimemin) || - (chptr->topic_time > lopt->topictimemax)) + if ((channel->topic_time < lopt->topictimemin) || + (channel->topic_time > lopt->topictimemax)) continue; /* Must not be on nolist (if it exists) */ - if (lopt->nolist && find_name_list_match(lopt->nolist, chptr->chname)) + if (lopt->nolist && find_name_list_match(lopt->nolist, channel->chname)) continue; /* Must be on yeslist (if it exists) */ - if (lopt->yeslist && !find_name_list_match(lopt->yeslist, chptr->chname)) + if (lopt->yeslist && !find_name_list_match(lopt->yeslist, channel->chname)) continue; } #ifdef LIST_SHOW_MODES modebuf[0] = '['; - channel_modes(client, modebuf+1, parabuf, sizeof(modebuf)-1, sizeof(parabuf), chptr); + channel_modes(client, modebuf+1, parabuf, sizeof(modebuf)-1, sizeof(parabuf), channel); if (modebuf[2] == '\0') modebuf[0] = '\0'; else strlcat(modebuf, "]", sizeof modebuf); #endif - if (!ValidatePermissionsForPath("channel:see:list:secret",client,NULL,chptr,NULL)) + if (!ValidatePermissionsForPath("channel:see:list:secret",client,NULL,channel,NULL)) sendnumeric(client, RPL_LIST, ShowChannel(client, - chptr) ? chptr->chname : - "*", chptr->users, + channel) ? channel->chname : + "*", channel->users, #ifdef LIST_SHOW_MODES - ShowChannel(client, chptr) ? + ShowChannel(client, channel) ? modebuf : "", #endif ShowChannel(client, - chptr) ? (chptr->topic ? - chptr->topic : "") : ""); + channel) ? (channel->topic ? + channel->topic : "") : ""); else - sendnumeric(client, RPL_LIST, chptr->chname, - chptr->users, + sendnumeric(client, RPL_LIST, channel->chname, + channel->users, #ifdef LIST_SHOW_MODES modebuf, #endif - (chptr->topic ? chptr->topic : "")); + (channel->topic ? channel->topic : "")); numsend--; } else diff --git a/src/modules/md.c b/src/modules/md.c index f5c516fb3..ba5fe7ed4 100644 --- a/src/modules/md.c +++ b/src/modules/md.c @@ -19,17 +19,17 @@ ModuleHeader MOD_HEADER CMD_FUNC(cmd_md); void _broadcast_md_client(ModDataInfo *mdi, Client *client, ModData *md); -void _broadcast_md_channel(ModDataInfo *mdi, Channel *chptr, ModData *md); -void _broadcast_md_member(ModDataInfo *mdi, Channel *chptr, Member *m, ModData *md); +void _broadcast_md_channel(ModDataInfo *mdi, Channel *channel, ModData *md); +void _broadcast_md_member(ModDataInfo *mdi, Channel *channel, Member *m, ModData *md); void _broadcast_md_membership(ModDataInfo *mdi, Client *client, Membership *m, ModData *md); void _broadcast_md_globalvar(ModDataInfo *mdi, ModData *md); void _broadcast_md_client_cmd(Client *except, Client *sender, Client *client, char *varname, char *value); -void _broadcast_md_channel_cmd(Client *except, Client *sender, Channel *chptr, char *varname, char *value); -void _broadcast_md_member_cmd(Client *except, Client *sender, Channel *chptr, Client *client, char *varname, char *value); -void _broadcast_md_membership_cmd(Client *except, Client *sender, Client *client, Channel *chptr, char *varname, char *value); +void _broadcast_md_channel_cmd(Client *except, Client *sender, Channel *channel, char *varname, char *value); +void _broadcast_md_member_cmd(Client *except, Client *sender, Channel *channel, Client *client, char *varname, char *value); +void _broadcast_md_membership_cmd(Client *except, Client *sender, Client *client, Channel *channel, char *varname, char *value); void _broadcast_md_globalvar_cmd(Client *except, Client *sender, char *varname, char *value); void _send_moddata_client(Client *srv, Client *client); -void _send_moddata_channel(Client *srv, Channel *chptr); +void _send_moddata_channel(Client *srv, Channel *channel); void _send_moddata_members(Client *srv); void _broadcast_moddata_client(Client *client); @@ -118,25 +118,25 @@ CMD_FUNC(cmd_md) } else if (!strcmp(type, "channel")) { - Channel *chptr = find_channel(objname, NULL); + Channel *channel = find_channel(objname, NULL); md = findmoddata_byname(varname, MODDATATYPE_CHANNEL); - if (!md || !md->unserialize || !chptr) + if (!md || !md->unserialize || !channel) return; if (value) - md->unserialize(value, &moddata_channel(chptr, md)); + md->unserialize(value, &moddata_channel(channel, md)); else { if (md->free) - md->free(&moddata_channel(chptr, md)); - memset(&moddata_channel(chptr, md), 0, sizeof(ModData)); + md->free(&moddata_channel(channel, md)); + memset(&moddata_channel(channel, md), 0, sizeof(ModData)); } /* Pass on to other servers */ - broadcast_md_channel_cmd(client->direction, client, chptr, varname, value); + broadcast_md_channel_cmd(client->direction, client, channel, varname, value); } else if (!strcmp(type, "member")) { Client *target; - Channel *chptr; + Channel *channel; Member *m; char *p; @@ -146,15 +146,15 @@ CMD_FUNC(cmd_md) return; *p++ = '\0'; - chptr = find_channel(objname, NULL); - if (!chptr) + channel = find_channel(objname, NULL); + if (!channel) return; target = find_person(p, NULL); if (!target) return; - m = find_member_link(chptr->members, target); + m = find_member_link(channel->members, target); if (!m) return; @@ -171,12 +171,12 @@ CMD_FUNC(cmd_md) memset(&moddata_member(m, md), 0, sizeof(ModData)); } /* Pass on to other servers */ - broadcast_md_member_cmd(client->direction, client, chptr, target, varname, value); + broadcast_md_member_cmd(client->direction, client, channel, target, varname, value); } else if (!strcmp(type, "membership")) { Client *target; - Channel *chptr; + Channel *channel; Membership *m; char *p; @@ -190,11 +190,11 @@ CMD_FUNC(cmd_md) if (!target) return; - chptr = find_channel(p, NULL); - if (!chptr) + channel = find_channel(p, NULL); + if (!channel) return; - m = find_membership_link(target->user->channel, chptr); + m = find_membership_link(target->user->channel, channel); if (!m) return; @@ -211,7 +211,7 @@ CMD_FUNC(cmd_md) memset(&moddata_membership(m, md), 0, sizeof(ModData)); } /* Pass on to other servers */ - broadcast_md_membership_cmd(client->direction, client, target, chptr, varname, value); + broadcast_md_membership_cmd(client->direction, client, target, channel, varname, value); } else if (!strcmp(type, "globalvar")) { @@ -250,49 +250,49 @@ void _broadcast_md_client_cmd(Client *except, Client *sender, Client *client, ch } } -void _broadcast_md_channel_cmd(Client *except, Client *sender, Channel *chptr, char *varname, char *value) +void _broadcast_md_channel_cmd(Client *except, Client *sender, Channel *channel, char *varname, char *value) { if (value) sendto_server(except, 0, 0, NULL, ":%s MD %s %s %s :%s", - sender->name, "channel", chptr->chname, varname, value); + sender->name, "channel", channel->chname, varname, value); else sendto_server(except, 0, 0, NULL, ":%s MD %s %s %s", - sender->name, "channel", chptr->chname, varname); + sender->name, "channel", channel->chname, varname); } -void _broadcast_md_member_cmd(Client *except, Client *sender, Channel *chptr, Client *client, char *varname, char *value) +void _broadcast_md_member_cmd(Client *except, Client *sender, Channel *channel, Client *client, char *varname, char *value) { if (value) { sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s:%s %s :%s", - sender->name, "member", chptr->chname, ID(client), varname, value); + sender->name, "member", channel->chname, ID(client), varname, value); sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s:%s %s :%s", - sender->name, "member", chptr->chname, client->name, varname, value); + sender->name, "member", channel->chname, client->name, varname, value); } else { sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s:%s %s", - sender->name, "member", chptr->chname, ID(client), varname); + sender->name, "member", channel->chname, ID(client), varname); sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s:%s %s", - sender->name, "member", chptr->chname, client->name, varname); + sender->name, "member", channel->chname, client->name, varname); } } -void _broadcast_md_membership_cmd(Client *except, Client *sender, Client *client, Channel *chptr, char *varname, char *value) +void _broadcast_md_membership_cmd(Client *except, Client *sender, Client *client, Channel *channel, char *varname, char *value) { if (value) { sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s:%s %s :%s", - sender->name, "membership", ID(client), chptr->chname, varname, value); + sender->name, "membership", ID(client), channel->chname, varname, value); sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s:%s %s :%s", - sender->name, "membership", client->name, chptr->chname, varname, value); + sender->name, "membership", client->name, channel->chname, varname, value); } else { sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s:%s %s", - sender->name, "membership", ID(client), chptr->chname, varname); + sender->name, "membership", ID(client), channel->chname, varname); sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s:%s %s", - sender->name, "membership", client->name, chptr->chname, varname); + sender->name, "membership", client->name, channel->chname, varname); } } @@ -327,25 +327,25 @@ void _broadcast_md_client(ModDataInfo *mdi, Client *client, ModData *md) broadcast_md_client_cmd(NULL, &me, client, mdi->name, value); } -void _broadcast_md_channel(ModDataInfo *mdi, Channel *chptr, ModData *md) +void _broadcast_md_channel(ModDataInfo *mdi, Channel *channel, ModData *md) { char *value = md ? mdi->serialize(md) : NULL; - broadcast_md_channel_cmd(NULL, &me, chptr, mdi->name, value); + broadcast_md_channel_cmd(NULL, &me, channel, mdi->name, value); } -void _broadcast_md_member(ModDataInfo *mdi, Channel *chptr, Member *m, ModData *md) +void _broadcast_md_member(ModDataInfo *mdi, Channel *channel, Member *m, ModData *md) { char *value = md ? mdi->serialize(md) : NULL; - broadcast_md_member_cmd(NULL, &me, chptr, m->client, mdi->name, value); + broadcast_md_member_cmd(NULL, &me, channel, m->client, mdi->name, value); } void _broadcast_md_membership(ModDataInfo *mdi, Client *client, Membership *m, ModData *md) { char *value = md ? mdi->serialize(md) : NULL; - broadcast_md_membership_cmd(NULL, &me, client, m->chptr, mdi->name, value); + broadcast_md_membership_cmd(NULL, &me, client, m->channel, mdi->name, value); } void _broadcast_md_globalvar(ModDataInfo *mdi, ModData *md) @@ -373,8 +373,8 @@ void _send_moddata_client(Client *srv, Client *client) } } -/** Send all moddata attached to channel 'chptr' to remote server 'srv' (if the module wants this), called by SJOIN */ -void _send_moddata_channel(Client *srv, Channel *chptr) +/** Send all moddata attached to channel 'channel' to remote server 'srv' (if the module wants this), called by SJOIN */ +void _send_moddata_channel(Client *srv, Channel *channel) { ModDataInfo *mdi; @@ -382,25 +382,25 @@ void _send_moddata_channel(Client *srv, Channel *chptr) { if ((mdi->type == MODDATATYPE_CHANNEL) && mdi->sync && mdi->serialize) { - char *value = mdi->serialize(&moddata_channel(chptr, mdi)); + char *value = mdi->serialize(&moddata_channel(channel, mdi)); if (value) sendto_one(srv, NULL, ":%s MD %s %s %s :%s", - me.name, "channel", chptr->chname, mdi->name, value); + me.name, "channel", channel->chname, mdi->name, value); } } } -/** Send all moddata attached to member & memberships for 'chptr' to remote server 'srv' (if the module wants this), called by SJOIN */ +/** Send all moddata attached to member & memberships for 'channel' to remote server 'srv' (if the module wants this), called by SJOIN */ void _send_moddata_members(Client *srv) { ModDataInfo *mdi; - Channel *chptr; + Channel *channel; Client *client; - for (chptr = channels; chptr; chptr = chptr->nextch) + for (channel = channels; channel; channel = channel->nextch) { Member *m; - for (m = chptr->members; m; m = m->next) + for (m = channel->members; m; m = m->next) { char *user = CHECKPROTO(srv, PROTO_SID) ? ID(m->client) : m->client->name; @@ -413,7 +413,7 @@ void _send_moddata_members(Client *srv) char *value = mdi->serialize(&moddata_member(m, mdi)); if (value) sendto_one(srv, NULL, ":%s MD %s %s:%s %s :%s", - me.name, "member", chptr->chname, user, mdi->name, value); + me.name, "member", channel->chname, user, mdi->name, value); } } } @@ -439,7 +439,7 @@ void _send_moddata_members(Client *srv) char *value = mdi->serialize(&moddata_membership(m, mdi)); if (value) sendto_one(srv, NULL, ":%s MD %s %s:%s %s :%s", - me.name, "membership", user, m->chptr->chname, mdi->name, value); + me.name, "membership", user, m->channel->chname, mdi->name, value); } } } diff --git a/src/modules/mdex.c b/src/modules/mdex.c index 7d69d953c..26388fbbb 100644 --- a/src/modules/mdex.c +++ b/src/modules/mdex.c @@ -104,23 +104,23 @@ CMD_FUNC(cmd_mdex) } else if (!strcmp(type, "channel")) { - Channel *chptr = find_channel(objname, NULL); + Channel *channel = find_channel(objname, NULL); md = findmoddata_byname(varname, MODDATATYPE_CHANNEL); - if (!md || !md->unserialize || !md->free || !chptr) + if (!md || !md->unserialize || !md->free || !channel) return 0; if (value) - md->unserialize(value, &moddata_channel(chptr, md)); + md->unserialize(value, &moddata_channel(channel, md)); else { - md->free(&moddata_channel(chptr, md)); - memset(&moddata_channel(chptr, md), 0, sizeof(ModData)); + md->free(&moddata_channel(channel, md)); + memset(&moddata_channel(channel, md), 0, sizeof(ModData)); } - broadcast_md_channel(md, chptr, &moddata_channel(chptr, md)); + broadcast_md_channel(md, channel, &moddata_channel(channel, md)); } else if (!strcmp(type, "member")) { Client *target; - Channel *chptr; + Channel *channel; Member *m; char *p; @@ -130,15 +130,15 @@ CMD_FUNC(cmd_mdex) return 0; *p++ = '\0'; - chptr = find_channel(objname, NULL); - if (!chptr) + channel = find_channel(objname, NULL); + if (!channel) return 0; target = find_person(p, NULL); if (!target) return 0; - m = find_member_link(chptr->members, target); + m = find_member_link(channel->members, target); if (!m) return 0; @@ -153,12 +153,12 @@ CMD_FUNC(cmd_mdex) md->free(&moddata_member(m, md)); memset(&moddata_member(m, md), 0, sizeof(ModData)); } - broadcast_md_member(md, chptr, m, &moddata_member(m, md)); + broadcast_md_member(md, channel, m, &moddata_member(m, md)); } else if (!strcmp(type, "membership")) { Client *target; - Channel *chptr; + Channel *channel; Membership *m; char *p; @@ -172,11 +172,11 @@ CMD_FUNC(cmd_mdex) if (!target) return 0; - chptr = find_channel(p, NULL); - if (!chptr) + channel = find_channel(p, NULL); + if (!channel) return 0; - m = find_membership_link(target->user->channel, chptr); + m = find_membership_link(target->user->channel, channel); if (!m) return 0; @@ -212,13 +212,13 @@ CMD_FUNC(cmd_mdex) } else if (!strcmp(type, "channel")) { - Channel *chptr = find_channel(objname, NULL); + Channel *channel = find_channel(objname, NULL); char *str; md = findmoddata_byname(varname, MODDATATYPE_CHANNEL); - if (!md || !md->serialize || !chptr) + if (!md || !md->serialize || !channel) return 0; - str = md->serialize(&moddata_channel(chptr, md)); + str = md->serialize(&moddata_channel(channel, md)); if (str) sendnotice(client, "Value: %s", str ? str : ""); else @@ -227,7 +227,7 @@ CMD_FUNC(cmd_mdex) if (!strcmp(type, "member")) { Client *target; - Channel *chptr; + Channel *channel; Member *m; char *p, *str; @@ -237,15 +237,15 @@ CMD_FUNC(cmd_mdex) return 0; *p++ = '\0'; - chptr = find_channel(objname, NULL); - if (!chptr) + channel = find_channel(objname, NULL); + if (!channel) return 0; target = find_person(p, NULL); if (!target) return 0; - m = find_member_link(chptr->members, target); + m = find_member_link(channel->members, target); if (!m) return 0; @@ -262,7 +262,7 @@ CMD_FUNC(cmd_mdex) if (!strcmp(type, "membership")) { Client *target; - Channel *chptr; + Channel *channel; Membership *m; char *p, *str; @@ -276,11 +276,11 @@ CMD_FUNC(cmd_mdex) if (!target) return 0; - chptr = find_channel(p, NULL); - if (!chptr) + channel = find_channel(p, NULL); + if (!channel) return 0; - m = find_membership_link(target->user->channel, chptr); + m = find_membership_link(target->user->channel, channel); if (!m) return 0; diff --git a/src/modules/message.c b/src/modules/message.c index 6e2e80af4..db3b883b8 100644 --- a/src/modules/message.c +++ b/src/modules/message.c @@ -28,7 +28,7 @@ int ban_version(Client *client, char *text); CMD_FUNC(cmd_private); CMD_FUNC(cmd_notice); void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[], int notice); -int _can_send(Client *client, Channel *chptr, char **msgtext, char **errmsg, int notice); +int _can_send(Client *client, Channel *channel, char **msgtext, char **errmsg, int notice); /* Place includes here */ #define MSG_PRIVATE "PRIVMSG" /* PRIV */ @@ -157,7 +157,7 @@ static int can_privmsg(Client *client, Client *target, int notice, char **text, void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[], int notice) { Client *target; - Channel *chptr; + Channel *channel; char *nick, *p, *p2, *pc, *text, *errmsg, *newcmd; int prefix = 0; char pfixchan[CHANNELLEN + 4]; @@ -211,7 +211,7 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[], prefix = 0; /* Message to channel */ - if (p2 && (chptr = find_channel(p2, NULL))) + if (p2 && (channel = find_channel(p2, NULL))) { if (p2 != nick) { @@ -255,22 +255,22 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[], if (prefix) { - if (MyUser(client) && !op_can_override("channel:override:message:prefix",client,chptr,NULL)) + if (MyUser(client) && !op_can_override("channel:override:message:prefix",client,channel,NULL)) { - Membership *lp = find_membership_link(client->user->channel, chptr); + Membership *lp = find_membership_link(client->user->channel, channel); /* Check if user is allowed to send. RULES: * Need at least voice (+) in order to send to +,% or @ * Need at least ops (@) in order to send to & or ~ */ if (!lp || !(lp->flags & (CHFL_VOICE|CHFL_HALFOP|CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN))) { - sendnumeric(client, ERR_CHANOPRIVSNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname); return; } if (!(prefix & PREFIX_OP) && ((prefix & PREFIX_OWNER) || (prefix & PREFIX_ADMIN)) && !(lp->flags & (CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN))) { - sendnumeric(client, ERR_CHANOPRIVSNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname); return; } } @@ -299,14 +299,14 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[], if (MyUser(client) && (*parv[2] == 1)) { - ret = check_dcc(client, chptr->chname, NULL, parv[2]); + ret = check_dcc(client, channel->chname, NULL, parv[2]); if (IsDead(client)) return; if (ret == 0) continue; } - if (IsVirus(client) && strcasecmp(chptr->chname, SPAMFILTER_VIRUSCHAN)) + if (IsVirus(client) && strcasecmp(channel->chname, SPAMFILTER_VIRUSCHAN)) { sendnotice(client, "You are only allowed to talk in '%s'", SPAMFILTER_VIRUSCHAN); continue; @@ -316,13 +316,13 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[], errmsg = NULL; if (MyUser(client) && !IsULine(client)) { - if (!can_send(client, chptr, &text, &errmsg, notice)) + if (!can_send(client, channel, &text, &errmsg, notice)) { if (!notice) { /* Send error message */ // TODO: move all the cansend shit to *errmsg ? if possible? - sendnumeric(client, ERR_CANNOTSENDTOCHAN, chptr->chname, errmsg, p2); + sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->chname, errmsg, p2); } continue; /* skip */ } @@ -338,14 +338,14 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[], text = parv[2]; - if (MyUser(client) && match_spamfilter(client, text, notice ? SPAMF_CHANNOTICE : SPAMF_CHANMSG, chptr->chname, 0, NULL)) + if (MyUser(client) && match_spamfilter(client, text, notice ? SPAMF_CHANNOTICE : SPAMF_CHANMSG, channel->chname, 0, NULL)) return; new_message(client, recv_mtags, &mtags); for (h = Hooks[HOOKTYPE_PRE_CHANMSG]; h; h = h->next) { - text = (*(h->func.pcharfunc))(client, chptr, mtags, text, notice); + text = (*(h->func.pcharfunc))(client, channel, mtags, text, notice); if (!text) break; } @@ -356,12 +356,12 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[], continue; } - sendto_channel(chptr, client, client, + sendto_channel(channel, client, client, prefix, 0, sendflags, mtags, notice ? ":%s NOTICE %s :%s" : ":%s PRIVMSG %s :%s", client->name, nick, text); - RunHook8(HOOKTYPE_CHANMSG, client, chptr, sendflags, prefix, nick, mtags, text, notice); + RunHook8(HOOKTYPE_CHANMSG, client, channel, sendflags, prefix, nick, mtags, text, notice); free_message_tags(mtags); @@ -844,14 +844,14 @@ int ban_version(Client *client, char *text) /** Can user send a message to this channel? * @param client The client - * @param chptr The channel + * @param channel The channel * @param msgtext The message to send (MAY be changed, even if user is allowed to send) * @param errmsg The error message (will be filled in) * @param notice If it's a NOTICE then this is set to 1. Set to 0 for PRIVMSG. * @returns Returns 1 if the user is allowed to send, otherwise 0. * (note that this behavior was reversed in UnrealIRCd versions <5.x. */ -int _can_send(Client *client, Channel *chptr, char **msgtext, char **errmsg, int notice) +int _can_send(Client *client, Channel *channel, char **msgtext, char **errmsg, int notice) { Membership *lp; int member, i = 0; @@ -862,16 +862,16 @@ int _can_send(Client *client, Channel *chptr, char **msgtext, char **errmsg, int *errmsg = NULL; - member = IsMember(client, chptr); + member = IsMember(client, channel); - if (chptr->mode.mode & MODE_NOPRIVMSGS && !member) + if (channel->mode.mode & MODE_NOPRIVMSGS && !member) { /* Channel does not accept external messages (+n). * Reject, unless HOOKTYPE_CAN_BYPASS_NO_EXTERNAL_MSGS tells otherwise. */ for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, BYPASS_CHANMSG_EXTERNAL); + i = (*(h->func.intfunc))(client, channel, BYPASS_CHANMSG_EXTERNAL); if (i != HOOK_CONTINUE) break; } @@ -882,9 +882,9 @@ int _can_send(Client *client, Channel *chptr, char **msgtext, char **errmsg, int } } - lp = find_membership_link(client->user->channel, chptr); - if (chptr->mode.mode & MODE_MODERATED && - !op_can_override("channel:override:message:moderated",client,chptr,NULL) && + lp = find_membership_link(client->user->channel, channel); + if (channel->mode.mode & MODE_MODERATED && + !op_can_override("channel:override:message:moderated",client,channel,NULL) && (!lp /* FIXME: UGLY */ || !(lp->flags & (CHFL_CHANOP | CHFL_VOICE | CHFL_CHANOWNER | CHFL_HALFOP | CHFL_CHANADMIN)))) { @@ -893,7 +893,7 @@ int _can_send(Client *client, Channel *chptr, char **msgtext, char **errmsg, int */ for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, BYPASS_CHANMSG_MODERATED); + i = (*(h->func.intfunc))(client, channel, BYPASS_CHANMSG_MODERATED); if (i != HOOK_CONTINUE) break; } @@ -907,7 +907,7 @@ int _can_send(Client *client, Channel *chptr, char **msgtext, char **errmsg, int /* Modules can plug in as well */ for (h = Hooks[HOOKTYPE_CAN_SEND]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, lp, msgtext, errmsg, notice); + i = (*(h->func.intfunc))(client, channel, lp, msgtext, errmsg, notice); if (i != HOOK_CONTINUE) { #ifdef DEBUGMODE @@ -930,13 +930,13 @@ int _can_send(Client *client, Channel *chptr, char **msgtext, char **errmsg, int /* Now we are going to check bans */ /* ..but first: exempt ircops */ - if (op_can_override("channel:override:message:ban",client,chptr,NULL)) + if (op_can_override("channel:override:message:ban",client,channel,NULL)) return 1; if ((!lp || !(lp->flags & (CHFL_CHANOP | CHFL_VOICE | CHFL_CHANOWNER | CHFL_HALFOP | CHFL_CHANADMIN))) && MyUser(client) - && is_banned(client, chptr, BANCHK_MSG, msgtext, errmsg)) + && is_banned(client, channel, BANCHK_MSG, msgtext, errmsg)) { /* Modules can set 'errmsg', otherwise we default to this: */ if (!*errmsg) diff --git a/src/modules/mode.c b/src/modules/mode.c index 013acdbd2..b7e264010 100644 --- a/src/modules/mode.c +++ b/src/modules/mode.c @@ -25,25 +25,25 @@ /* Forward declarations */ CMD_FUNC(cmd_mode); CMD_FUNC(cmd_mlock); -void _do_mode(Channel *chptr, Client *client, MessageTag *recv_mtags, int parc, char *parv[], time_t sendts, int samode); -void _set_mode(Channel *chptr, Client *client, int parc, char *parv[], u_int *pcount, +void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc, char *parv[], time_t sendts, int samode); +void _set_mode(Channel *channel, Client *client, int parc, char *parv[], u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce); CMD_FUNC(_cmd_umode); /* local: */ static void bounce_mode(Channel *, Client *, int, char **); -int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, +int do_mode_char(Channel *channel, long modetype, char modechar, char *param, u_int what, Client *client, u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char bounce, long my_access); -int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, +int do_extmode_char(Channel *channel, Cmode *handler, char *param, u_int what, Client *client, u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char bounce); -void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcount, +void make_mode_str(Channel *channel, long oldm, Cmode_t oldem, long oldl, int pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char *mode_buf, char *para_buf, size_t mode_buf_size, size_t para_buf_size, char bounce); static void mode_cutoff(char *s); -static void mode_cutoff2(Client *client, Channel *chptr, int *parc_out, char *parv[]); +static void mode_cutoff2(Client *client, Channel *channel, int *parc_out, char *parv[]); static int samode_in_progress = 0; @@ -98,15 +98,15 @@ CMD_FUNC(cmd_mode) { long unsigned sendts = 0; Ban *ban; - Channel *chptr; + Channel *channel; /* Now, try to find the channel in question */ if (parc > 1) { if (*parv[1] == '#') { - chptr = find_channel(parv[1], NULL); - if (!chptr) + channel = find_channel(parv[1], NULL); + if (!channel) { return cmd_umode(client, recv_mtags, parc, parv); } @@ -128,9 +128,9 @@ CMD_FUNC(cmd_mode) *modebuf = *parabuf = '\0'; modebuf[1] = '\0'; - channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr); - sendnumeric(client, RPL_CHANNELMODEIS, chptr->chname, modebuf, parabuf); - sendnumeric(client, RPL_CREATIONTIME, chptr->chname, chptr->creationtime); + channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel); + sendnumeric(client, RPL_CHANNELMODEIS, channel->chname, modebuf, parabuf); + sendnumeric(client, RPL_CREATIONTIME, channel->chname, channel->creationtime); return; } @@ -145,33 +145,33 @@ CMD_FUNC(cmd_mode) */ if (strstr(parv[2], "b") && BadPtr(parv[3])) { - if (!IsMember(client, chptr) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",client,NULL,chptr,NULL)) + if (!IsMember(client, channel) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",client,NULL,channel,NULL)) return; /* send ban list */ - for (ban = chptr->banlist; ban; ban = ban->next) - sendnumeric(client, RPL_BANLIST, chptr->chname, ban->banstr, ban->who, ban->when); - sendnumeric(client, RPL_ENDOFBANLIST, chptr->chname); + for (ban = channel->banlist; ban; ban = ban->next) + sendnumeric(client, RPL_BANLIST, channel->chname, ban->banstr, ban->who, ban->when); + sendnumeric(client, RPL_ENDOFBANLIST, channel->chname); return; } if (strstr(parv[2], "e") && BadPtr(parv[3])) { - if (!IsMember(client, chptr) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",client,NULL,chptr,NULL)) + if (!IsMember(client, channel) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",client,NULL,channel,NULL)) return; /* send exban list */ - for (ban = chptr->exlist; ban; ban = ban->next) - sendnumeric(client, RPL_EXLIST, chptr->chname, ban->banstr, ban->who, ban->when); - sendnumeric(client, RPL_ENDOFEXLIST, chptr->chname); + for (ban = channel->exlist; ban; ban = ban->next) + sendnumeric(client, RPL_EXLIST, channel->chname, ban->banstr, ban->who, ban->when); + sendnumeric(client, RPL_ENDOFEXLIST, channel->chname); return; } if (strstr(parv[2], "I") && BadPtr(parv[3])) { - if (!IsMember(client, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteinvexlist",client,NULL,chptr,NULL)) + if (!IsMember(client, channel) && !ValidatePermissionsForPath("channel:see:mode:remoteinvexlist",client,NULL,channel,NULL)) return; - for (ban = chptr->invexlist; ban; ban = ban->next) - sendnumeric(client, RPL_INVEXLIST, chptr->chname, ban->banstr, ban->who, ban->when); - sendnumeric(client, RPL_ENDOFINVEXLIST, chptr->chname); + for (ban = channel->invexlist; ban; ban = ban->next) + sendnumeric(client, RPL_INVEXLIST, channel->chname, ban->banstr, ban->who, ban->when); + sendnumeric(client, RPL_ENDOFINVEXLIST, channel->chname); return; } @@ -179,15 +179,15 @@ CMD_FUNC(cmd_mode) { Member *member; - if (!IsMember(client, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",client,NULL,chptr,NULL)) + if (!IsMember(client, channel) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",client,NULL,channel,NULL)) return; - for (member = chptr->members; member; member = member->next) + for (member = channel->members; member; member = member->next) { - if (is_chanowner(member->client, chptr)) - sendnumeric(client, RPL_QLIST, chptr->chname, member->client->name); + if (is_chanowner(member->client, channel)) + sendnumeric(client, RPL_QLIST, channel->chname, member->client->name); } - sendnumeric(client, RPL_ENDOFQLIST, chptr->chname); + sendnumeric(client, RPL_ENDOFQLIST, channel->chname); return; } @@ -195,15 +195,15 @@ CMD_FUNC(cmd_mode) { Member *member; - if (!IsMember(client, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",client,NULL,chptr,NULL)) + if (!IsMember(client, channel) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",client,NULL,channel,NULL)) return; - for (member = chptr->members; member; member = member->next) + for (member = channel->members; member; member = member->next) { - if (is_chanadmin(member->client, chptr)) - sendnumeric(client, RPL_ALIST, chptr->chname, member->client->name); + if (is_chanadmin(member->client, channel)) + sendnumeric(client, RPL_ALIST, channel->chname, member->client->name); } - sendnumeric(client, RPL_ENDOFALIST, chptr->chname); + sendnumeric(client, RPL_ENDOFALIST, channel->chname); return; } } @@ -211,16 +211,16 @@ CMD_FUNC(cmd_mode) opermode = 0; #ifndef NO_OPEROVERRIDE - if (IsUser(client) && !IsULine(client) && !is_chan_op(client, chptr) && - !is_half_op(client, chptr) && ValidatePermissionsForPath("channel:override:mode",client,NULL,chptr,NULL)) + if (IsUser(client) && !IsULine(client) && !is_chan_op(client, channel) && + !is_half_op(client, channel) && ValidatePermissionsForPath("channel:override:mode",client,NULL,channel,NULL)) { sendts = 0; opermode = 1; goto aftercheck; } - if (IsUser(client) && !IsULine(client) && !is_chan_op(client, chptr) && - is_half_op(client, chptr) && ValidatePermissionsForPath("channel:override:mode",client,NULL,chptr,NULL)) + if (IsUser(client) && !IsULine(client) && !is_chan_op(client, channel) && + is_half_op(client, channel) && ValidatePermissionsForPath("channel:override:mode",client,NULL,channel,NULL)) { opermode = 2; goto aftercheck; @@ -228,35 +228,35 @@ CMD_FUNC(cmd_mode) #endif /* User does not have permission to use the MODE command */ - if (IsUser(client) && !IsULine(client) && !is_chan_op(client, chptr) && - !is_half_op(client, chptr) && - !ValidatePermissionsForPath("channel:override:mode",client,NULL,chptr,NULL)) + if (IsUser(client) && !IsULine(client) && !is_chan_op(client, channel) && + !is_half_op(client, channel) && + !ValidatePermissionsForPath("channel:override:mode",client,NULL,channel,NULL)) { if (MyUser(client)) { - sendnumeric(client, ERR_CHANOPRIVSNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname); return; } sendto_one(client, NULL, ":%s MODE %s -oh %s %s 0", - me.name, chptr->chname, client->name, client->name); + me.name, channel->chname, client->name, client->name); /* Tell the other server that the user is * de-opped. Fix op desyncs. */ - bounce_mode(chptr, client, parc - 2, parv + 2); + bounce_mode(channel, client, parc - 2, parv + 2); return; } if (IsServer(client) && (sendts = atol(parv[parc - 1])) && - !IsULine(client) && chptr->creationtime && - sendts > chptr->creationtime) + !IsULine(client) && channel->creationtime && + sendts > channel->creationtime) { if (!(*parv[2] == '&')) /* & denotes a bounce */ { /* !!! */ sendto_snomask(SNO_EYES, "*** TS bounce for %s - %lld(ours) %lld(theirs)", - chptr->chname, (long long)chptr->creationtime, + channel->chname, (long long)channel->creationtime, (long long)sendts); - bounce_mode(chptr, client, parc - 2, parv + 2); + bounce_mode(channel, client, parc - 2, parv + 2); } return; } @@ -271,14 +271,14 @@ aftercheck: if (MyUser(client) && parv[2]) { mode_cutoff(parv[2]); - mode_cutoff2(client, chptr, &parc, parv); + mode_cutoff2(client, channel, &parc, parv); } /* Filter out the unprivileged FIRST. * * Now, we can actually do the mode. */ - (void)do_mode(chptr, client, recv_mtags, parc - 2, parv + 2, sendts, 0); - /* After this don't touch 'chptr' anymore, as permanent module may have destroyed the channel */ + (void)do_mode(channel, client, recv_mtags, parc - 2, parv + 2, sendts, 0); + /* After this don't touch 'channel' anymore, as permanent module may have destroyed the channel */ opermode = 0; /* Important since sometimes forgotten. -- Syzop */ } @@ -301,7 +301,7 @@ unsigned short modesleft = MAXMODEPARAMS * 2; /* be generous... */ * amplification/enlargement problem that happens with bans/exempts/invex * as explained in #2837. -- Syzop */ -static void mode_cutoff2(Client *client, Channel *chptr, int *parc_out, char *parv[]) +static void mode_cutoff2(Client *client, Channel *channel, int *parc_out, char *parv[]) { int len, i; int parc = *parc_out; @@ -312,7 +312,7 @@ static void mode_cutoff2(Client *client, Channel *chptr, int *parc_out, char *pa /* Calculate length of MODE if it would go through fully as-is */ /* :nick!user@host MODE #channel +something param1 param2 etc... */ len = strlen(client->name) + strlen(client->user->username) + strlen(GetHost(client)) + - strlen(chptr->chname) + 11; + strlen(channel->chname) + 11; len += strlen(parv[2]); @@ -362,18 +362,18 @@ static void mode_cutoff2(Client *client, Channel *chptr, int *parc_out, char *pa * param (last param) of the calls to set_mode and make_mode_str, it will not * set the mode, but create the bounce string. */ -static void bounce_mode(Channel *chptr, Client *client, int parc, char *parv[]) +static void bounce_mode(Channel *channel, Client *client, int parc, char *parv[]) { char pvar[MAXMODEPARAMS][MODEBUFLEN + 3]; int pcount; - set_mode(chptr, client, parc, parv, &pcount, pvar, 1); + set_mode(channel, client, parc, parv, &pcount, pvar, 1); - if (chptr->creationtime) + if (channel->creationtime) sendto_one(client, NULL, ":%s MODE %s &%s %s %lld", me.name, - chptr->chname, modebuf, parabuf, (long long)chptr->creationtime); + channel->chname, modebuf, parabuf, (long long)channel->creationtime); else - sendto_one(client, NULL, ":%s MODE %s &%s %s", me.name, chptr->chname, + sendto_one(client, NULL, ":%s MODE %s &%s %s", me.name, channel->chname, modebuf, parabuf); /* the '&' denotes a bounce so servers won't bounce a bounce */ @@ -383,7 +383,7 @@ static void bounce_mode(Channel *chptr, Client *client, int parc, char *parv[]) * User or server is authorized to do the mode. This takes care of * setting the mode and relaying it to other users and servers. */ -void _do_mode(Channel *chptr, Client *client, MessageTag *recv_mtags, int parc, char *parv[], time_t sendts, int samode) +void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc, char *parv[], time_t sendts, int samode) { char pvar[MAXMODEPARAMS][MODEBUFLEN + 3]; int pcount; @@ -399,44 +399,44 @@ void _do_mode(Channel *chptr, Client *client, MessageTag *recv_mtags, int parc, /* Please keep the next 3 lines next to each other */ samode_in_progress = samode; - set_mode(chptr, client, parc, parv, &pcount, pvar, 0); + set_mode(channel, client, parc, parv, &pcount, pvar, 0); samode_in_progress = 0; if (MyConnect(client)) - RunHook7(HOOKTYPE_PRE_LOCAL_CHANMODE, client, chptr, mtags, modebuf, parabuf, sendts, samode); + RunHook7(HOOKTYPE_PRE_LOCAL_CHANMODE, client, channel, mtags, modebuf, parabuf, sendts, samode); else - RunHook7(HOOKTYPE_PRE_REMOTE_CHANMODE, client, chptr, mtags, modebuf, parabuf, sendts, samode); + RunHook7(HOOKTYPE_PRE_REMOTE_CHANMODE, client, channel, mtags, modebuf, parabuf, sendts, samode); if (IsServer(client)) { if (sendts > 0) { - if (!chptr->creationtime || sendts < chptr->creationtime) + if (!channel->creationtime || sendts < channel->creationtime) { tschange = 1; - chptr->creationtime = sendts; + channel->creationtime = sendts; if (sendts < 750000) { sendto_realops( "Warning! Possible desynch: MODE for channel %s ('%s %s') has fishy timestamp (%lld) (from %s/%s)", - chptr->chname, modebuf, parabuf, (long long)sendts, client->direction->name, client->name); + channel->chname, modebuf, parabuf, (long long)sendts, client->direction->name, client->name); ircd_log(LOG_ERROR, "Possible desynch: MODE for channel %s ('%s %s') has fishy timestamp (%lld) (from %s/%s)", - chptr->chname, modebuf, parabuf, (long long)sendts, client->direction->name, client->name); + channel->chname, modebuf, parabuf, (long long)sendts, client->direction->name, client->name); } /* new chan or our timestamp is wrong */ /* now works for double-bounce prevention */ } - if (sendts > chptr->creationtime && chptr->creationtime) + if (sendts > channel->creationtime && channel->creationtime) { /* theirs is wrong but we let it pass anyway */ - sendts = chptr->creationtime; + sendts = channel->creationtime; sendto_one(client, NULL, ":%s MODE %s + %lld", me.name, - chptr->chname, (long long)chptr->creationtime); + channel->chname, (long long)channel->creationtime); } } - if (sendts == -1 && chptr->creationtime) - sendts = chptr->creationtime; + if (sendts == -1 && channel->creationtime) + sendts = channel->creationtime; } if (*modebuf == '\0' || (*(modebuf + 1) == '\0' && (*modebuf == '+' || *modebuf == '-'))) @@ -444,14 +444,14 @@ void _do_mode(Channel *chptr, Client *client, MessageTag *recv_mtags, int parc, if (tschange || isbounce) { /* relay bounce time changes */ - if (chptr->creationtime) + if (channel->creationtime) { sendto_server(client, 0, 0, NULL, ":%s MODE %s %s+ %lld", - me.name, chptr->chname, isbounce ? "&" : "", - (long long)chptr->creationtime); + me.name, channel->chname, isbounce ? "&" : "", + (long long)channel->creationtime); } else { sendto_server(client, 0, 0, NULL, ":%s MODE %s %s+", - me.name, chptr->chname, isbounce ? "&" : ""); + me.name, channel->chname, isbounce ? "&" : ""); } free_message_tags(mtags); return; /* nothing to send */ @@ -467,12 +467,12 @@ void _do_mode(Channel *chptr, Client *client, MessageTag *recv_mtags, int parc, sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) MODE %s %s %s", client->name, client->user->username, client->user->realhost, - chptr->chname, modebuf, parabuf); + channel->chname, modebuf, parabuf); /* Logging Implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) MODE %s %s %s", client->name, client->user->username, client->user->realhost, - chptr->chname, modebuf, parabuf); + channel->chname, modebuf, parabuf); } sendts = 0; @@ -490,21 +490,21 @@ void _do_mode(Channel *chptr, Client *client, MessageTag *recv_mtags, int parc, { if (!sajoinmode) sendto_umode_global(UMODE_OPER, "%s used SAMODE %s (%s%s%s)", - client->name, chptr->chname, modebuf, *parabuf ? " " : "", parabuf); + client->name, channel->chname, modebuf, *parabuf ? " " : "", parabuf); client = &me; sendts = 0; } - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", - client->name, chptr->chname, modebuf, parabuf); + client->name, channel->chname, modebuf, parabuf); if (IsServer(client) && sendts != -1) { sendto_server(client, 0, 0, mtags, ":%s MODE %s %s%s %s %lld", - client->name, chptr->chname, + client->name, channel->chname, isbounce ? "&" : "", modebuf, parabuf, (long long)sendts); } else @@ -513,22 +513,22 @@ void _do_mode(Channel *chptr, Client *client, MessageTag *recv_mtags, int parc, /* SAMODE is a special case: always send a TS of 0 (omitting TS==desynch) */ sendto_server(client, 0, 0, mtags, ":%s MODE %s %s %s 0", - client->name, chptr->chname, modebuf, parabuf); + client->name, channel->chname, modebuf, parabuf); } else { sendto_server(client, 0, 0, mtags, ":%s MODE %s %s%s %s", - client->name, chptr->chname, isbounce ? "&" : "", modebuf, parabuf); + client->name, channel->chname, isbounce ? "&" : "", modebuf, parabuf); /* tell them it's not a timestamp, in case the last param ** is a number. */ } if (MyConnect(client)) - RunHook7(HOOKTYPE_LOCAL_CHANMODE, client, chptr, mtags, modebuf, parabuf, sendts, samode); + RunHook7(HOOKTYPE_LOCAL_CHANMODE, client, channel, mtags, modebuf, parabuf, sendts, samode); else - RunHook7(HOOKTYPE_REMOTE_CHANMODE, client, chptr, mtags, modebuf, parabuf, sendts, samode); + RunHook7(HOOKTYPE_REMOTE_CHANMODE, client, channel, mtags, modebuf, parabuf, sendts, samode); - /* After this, don't touch 'chptr' anymore! As permanent module may have destroyed the channel. */ + /* After this, don't touch 'channel' anymore! As permanent module may have destroyed the channel. */ free_message_tags(mtags); @@ -538,7 +538,7 @@ void _do_mode(Channel *chptr, Client *client, MessageTag *recv_mtags, int parc, * contain the +x-y stuff, and the parabuf will contain the parameters. * If bounce is set to 1, it will make the string it needs for a bounce. */ -void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcount, +void make_mode_str(Channel *channel, long oldm, Cmode_t oldem, long oldl, int pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char *mode_buf, char *para_buf, size_t mode_buf_size, size_t para_buf_size, char bounce) { @@ -558,7 +558,7 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou tab = &corechannelmodetable[0]; while (tab->mode != 0x0) { - if (chptr->mode.mode & tab->mode) + if (channel->mode.mode & tab->mode) { if (!(oldm & tab->mode)) { @@ -579,7 +579,7 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou if (!Channelmode_Table[i].flag || Channelmode_Table[i].paracount) continue; /* have it now and didn't have it before? */ - if ((chptr->mode.extmode & Channelmode_Table[i].mode) && + if ((channel->mode.extmode & Channelmode_Table[i].mode) && !(oldem & Channelmode_Table[i].mode)) { if (what != MODE_ADD) @@ -596,7 +596,7 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou tab = &corechannelmodetable[0]; while (tab->mode != 0x0) { - if (!(chptr->mode.mode & tab->mode)) + if (!(channel->mode.mode & tab->mode)) { if (oldm & tab->mode) { @@ -619,7 +619,7 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou if (!Channelmode_Table[i].flag || Channelmode_Table[i].unset_with_param) continue; /* don't have it now and did have it before */ - if (!(chptr->mode.extmode & Channelmode_Table[i].mode) && + if (!(channel->mode.extmode & Channelmode_Table[i].mode) && (oldem & Channelmode_Table[i].mode)) { if (what != MODE_DEL) @@ -633,10 +633,10 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou *x = '\0'; /* user limit */ - if (chptr->mode.limit != oldl) + if (channel->mode.limit != oldl) { - if ((!bounce && chptr->mode.limit == 0) || - (bounce && chptr->mode.limit != 0)) + if ((!bounce && channel->mode.limit == 0) || + (bounce && channel->mode.limit != 0)) { if (what != MODE_DEL) { @@ -644,7 +644,7 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou what = MODE_DEL; } if (bounce) - chptr->mode.limit = 0; /* set it back */ + channel->mode.limit = 0; /* set it back */ *x++ = 'l'; } else @@ -656,8 +656,8 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou } *x++ = 'l'; if (bounce) - chptr->mode.limit = oldl; /* set it back */ - ircsnprintf(para_buf, para_buf_size, "%s%d ", para_buf, chptr->mode.limit); + channel->mode.limit = oldl; /* set it back */ + ircsnprintf(para_buf, para_buf_size, "%s%d ", para_buf, channel->mode.limit); } } /* reconstruct bkov chain */ @@ -689,8 +689,8 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou } if (bounce) { - chptr->mode.mode = oldm; - chptr->mode.extmode = oldem; + channel->mode.mode = oldm; + channel->mode.extmode = oldem; } z = strlen(para_buf); if ((z > 0) && (para_buf[z - 1] == ' ')) @@ -722,7 +722,7 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou #define is_xchanop(x) ((x & CHFL_CHANOP)) #endif -int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, +int do_mode_char(Channel *channel, long modetype, char modechar, char *param, u_int what, Client *client, u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char bounce, long my_access) @@ -739,7 +739,7 @@ int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, Hook *h; if ((my_access & CHFL_HALFOP) && !is_xchanop(my_access) && !IsULine(client) && - !op_can_override("channel:override:mode",client,chptr,&modetype) && !samode_in_progress) + !op_can_override("channel:override:mode",client,channel,&modetype) && !samode_in_progress) { if (MyUser(client) && (modetype == MODE_HALFOP) && (what == MODE_DEL) && param && (find_client(param, NULL) == client)) @@ -773,7 +773,7 @@ int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, case MODE_RGSTR: if (!IsServer(client) && !IsULine(client)) { - sendnumeric(client, ERR_ONLYSERVERSCANCHANGE, chptr->chname); + sendnumeric(client, ERR_ONLYSERVERSCANCHANGE, channel->chname); break; } goto setmode; @@ -788,45 +788,45 @@ int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, retval = 0; if (what == MODE_ADD) { /* +sp bugfix.. (by JK/Luke)*/ - if ((modetype == MODE_SECRET) && (chptr->mode.mode & MODE_PRIVATE)) - chptr->mode.mode &= ~MODE_PRIVATE; - if ((modetype == MODE_PRIVATE) && (chptr->mode.mode & MODE_SECRET)) - chptr->mode.mode &= ~MODE_SECRET; - chptr->mode.mode |= modetype; + if ((modetype == MODE_SECRET) && (channel->mode.mode & MODE_PRIVATE)) + channel->mode.mode &= ~MODE_PRIVATE; + if ((modetype == MODE_PRIVATE) && (channel->mode.mode & MODE_SECRET)) + channel->mode.mode &= ~MODE_SECRET; + channel->mode.mode |= modetype; } else { - chptr->mode.mode &= ~modetype; - RunHook2(HOOKTYPE_MODECHAR_DEL, chptr, (int)modechar); + channel->mode.mode &= ~modetype; + RunHook2(HOOKTYPE_MODECHAR_DEL, channel, (int)modechar); } break; /* do pro-opping here (popping) */ case MODE_CHANOWNER: REQUIRE_PARAMETER() - if (!IsULine(client) && !IsServer(client) && !is_chanowner(client, chptr) && !samode_in_progress) + if (!IsULine(client) && !IsServer(client) && !is_chanowner(client, channel) && !samode_in_progress) { - if (MyUser(client) && !op_can_override("channel:override:mode",client,chptr,&modetype)) + if (MyUser(client) && !op_can_override("channel:override:mode",client,channel,&modetype)) { - sendnumeric(client, ERR_CHANOWNPRIVNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->chname); break; } - if (!is_half_op(client, chptr)) /* htrig will take care of halfop override notices */ + if (!is_half_op(client, channel)) /* htrig will take care of halfop override notices */ opermode = 1; } goto process_listmode; case MODE_CHANADMIN: REQUIRE_PARAMETER() /* not uline, not server, not chanowner, not an samode, not -a'ing yourself... */ - if (!IsULine(client) && !IsServer(client) && !is_chanowner(client, chptr) && !samode_in_progress && + if (!IsULine(client) && !IsServer(client) && !is_chanowner(client, channel) && !samode_in_progress && !(param && (what == MODE_DEL) && (find_client(param, NULL) == client))) { - if (MyUser(client) && !op_can_override("channel:override:mode",client,chptr,&modetype)) + if (MyUser(client) && !op_can_override("channel:override:mode",client,channel,&modetype)) { - sendnumeric(client, ERR_CHANOWNPRIVNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->chname); break; } - if (!is_half_op(client, chptr)) /* htrig will take care of halfop override notices */ + if (!is_half_op(client, channel)) /* htrig will take care of halfop override notices */ opermode = 1; } goto process_listmode; @@ -840,12 +840,12 @@ process_listmode: break; if (!target->user) break; - if (!(membership = find_membership_link(target->user->channel, chptr))) + if (!(membership = find_membership_link(target->user->channel, channel))) { - sendnumeric(client, ERR_USERNOTINCHANNEL, target->name, chptr->chname); + sendnumeric(client, ERR_USERNOTINCHANNEL, target->name, channel->chname); break; } - member = find_member_link(chptr->members, target); + member = find_member_link(channel->members, target); if (!member) { /* should never happen */ @@ -863,7 +863,7 @@ process_listmode: for (h = Hooks[HOOKTYPE_MODE_DEOP]; h; h = h->next) { - int n = (*(h->func.intfunc))(client, member->client, chptr, what, modechar, my_access, &badmode); + int n = (*(h->func.intfunc))(client, member->client, channel, what, modechar, my_access, &badmode); if (n == EX_DENY) ret = n; else if (n == EX_ALWAYS_DENY) @@ -885,7 +885,7 @@ process_listmode: /* This probably should work but is completely untested (the operoverride stuff, I mean): */ if (ret == EX_DENY) { - if (!op_can_override("channel:override:mode:del",client,chptr,&modetype)) + if (!op_can_override("channel:override:mode:del",client,channel,&modetype)) { if (badmode) sendto_one(client, NULL, "%s", badmode); /* send error message, if any */ @@ -899,9 +899,9 @@ process_listmode: /* This check not only prevents unprivileged users from doing a -q on chanowners, * it also protects against -o/-h/-v on them. */ - if (is_chanowner(member->client, chptr) + if (is_chanowner(member->client, channel) && member->client != client - && !is_chanowner(client, chptr) && !IsServer(client) + && !is_chanowner(client, channel) && !IsServer(client) && !IsULine(client) && !opermode && !samode_in_progress && (what == MODE_DEL)) { if (MyUser(client)) @@ -909,7 +909,7 @@ process_listmode: /* Need this !op_can_override() here again, even with the !opermode * check a few lines up, all due to halfops. -- Syzop */ - if (!op_can_override("channel:override:mode:del",client,chptr,&modetype)) + if (!op_can_override("channel:override:mode:del",client,channel,&modetype)) { char errbuf[NICKLEN+30]; ircsnprintf(errbuf, sizeof(errbuf), "%s is a channel owner", member->client->name); @@ -925,9 +925,9 @@ process_listmode: /* This check not only prevents unprivileged users from doing a -a on chanadmins, * it also protects against -o/-h/-v on them. */ - if (is_chanadmin(member->client, chptr) + if (is_chanadmin(member->client, channel) && member->client != client - && !is_chanowner(client, chptr) && !IsServer(client) && !opermode && !samode_in_progress + && !is_chanowner(client, channel) && !IsServer(client) && !opermode && !samode_in_progress && modetype != MODE_CHANOWNER && (what == MODE_DEL)) { if (MyUser(client)) @@ -935,7 +935,7 @@ process_listmode: /* Need this !op_can_override() here again, even with the !opermode * check a few lines up, all due to halfops. -- Syzop */ - if (!op_can_override("channel:override:mode:del",client,chptr,&modetype)) + if (!op_can_override("channel:override:mode:del",client,channel,&modetype)) { char errbuf[NICKLEN+30]; ircsnprintf(errbuf, sizeof(errbuf), "%s is a channel admin", member->client->name); @@ -983,17 +983,17 @@ process_listmode: { REQUIRE_PARAMETER() tmp = atoi(param); - if (chptr->mode.limit == tmp) + if (channel->mode.limit == tmp) break; - chptr->mode.limit = tmp; + channel->mode.limit = tmp; } else { retval = 0; - if (!chptr->mode.limit) + if (!channel->mode.limit) break; - chptr->mode.limit = 0; - RunHook2(HOOKTYPE_MODECHAR_DEL, chptr, (int)modechar); + channel->mode.limit = 0; + RunHook2(HOOKTYPE_MODECHAR_DEL, channel, (int)modechar); } break; case MODE_KEY: @@ -1023,21 +1023,21 @@ process_listmode: break; if (strlen(param) > KEYLEN) param[KEYLEN] = '\0'; - if (!strcmp(chptr->mode.key, param)) + if (!strcmp(channel->mode.key, param)) break; - strlcpy(chptr->mode.key, param, sizeof(chptr->mode.key)); + strlcpy(channel->mode.key, param, sizeof(channel->mode.key)); } tmpstr = param; } else { - if (!*chptr->mode.key) + if (!*channel->mode.key) break; /* no change */ - strlcpy(tmpbuf, chptr->mode.key, sizeof(tmpbuf)); + strlcpy(tmpbuf, channel->mode.key, sizeof(tmpbuf)); tmpstr = tmpbuf; if (!bounce) - strcpy(chptr->mode.key, ""); - RunHook2(HOOKTYPE_MODECHAR_DEL, chptr, (int)modechar); + strcpy(channel->mode.key, ""); + RunHook2(HOOKTYPE_MODECHAR_DEL, channel, (int)modechar); } retval = 1; @@ -1058,7 +1058,7 @@ process_listmode: { Extban *p = findmod_by_bantype(param[1]); if (p && p->is_ok) - p->is_ok(client, chptr, param, EXBCHK_PARAM, what, EXBTYPE_BAN); + p->is_ok(client, channel, param, EXBCHK_PARAM, what, EXBTYPE_BAN); } break; /* ignore ban, but eat param */ @@ -1069,17 +1069,17 @@ process_listmode: Extban *p = findmod_by_bantype(tmpstr[1]); if (p && p->is_ok) { - if (!p->is_ok(client, chptr, tmpstr, EXBCHK_ACCESS, what, EXBTYPE_BAN)) + if (!p->is_ok(client, channel, tmpstr, EXBCHK_ACCESS, what, EXBTYPE_BAN)) { - if (ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,chptr,NULL)) + if (ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,channel,NULL)) { /* TODO: send operoverride notice */ } else { - p->is_ok(client, chptr, tmpstr, EXBCHK_ACCESS_ERR, what, EXBTYPE_BAN); + p->is_ok(client, channel, tmpstr, EXBCHK_ACCESS_ERR, what, EXBTYPE_BAN); break; } } - if (!p->is_ok(client, chptr, tmpstr, EXBCHK_PARAM, what, EXBTYPE_BAN)) + if (!p->is_ok(client, channel, tmpstr, EXBCHK_PARAM, what, EXBTYPE_BAN)) break; } } @@ -1087,8 +1087,8 @@ process_listmode: * or not it exists on our server. We'll just always * bounce it. */ if (!bounce && - ((what == MODE_ADD && add_listmode(&chptr->banlist, client, chptr, tmpstr)) - || (what == MODE_DEL && del_listmode(&chptr->banlist, chptr, tmpstr)))) + ((what == MODE_ADD && add_listmode(&channel->banlist, client, channel, tmpstr)) + || (what == MODE_DEL && del_listmode(&channel->banlist, channel, tmpstr)))) { break; /* already exists */ } @@ -1108,17 +1108,17 @@ process_listmode: Extban *p = findmod_by_bantype(tmpstr[1]); if (p && p->is_ok) { - if (!p->is_ok(client, chptr, tmpstr, EXBCHK_ACCESS, what, EXBTYPE_EXCEPT)) + if (!p->is_ok(client, channel, tmpstr, EXBCHK_ACCESS, what, EXBTYPE_EXCEPT)) { - if (ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,chptr,NULL)) + if (ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,channel,NULL)) { /* TODO: send operoverride notice */ } else { - p->is_ok(client, chptr, tmpstr, EXBCHK_ACCESS_ERR, what, EXBTYPE_EXCEPT); + p->is_ok(client, channel, tmpstr, EXBCHK_ACCESS_ERR, what, EXBTYPE_EXCEPT); break; } } - if (!p->is_ok(client, chptr, tmpstr, EXBCHK_PARAM, what, EXBTYPE_EXCEPT)) + if (!p->is_ok(client, channel, tmpstr, EXBCHK_PARAM, what, EXBTYPE_EXCEPT)) break; } } @@ -1126,8 +1126,8 @@ process_listmode: * or not it exists on our server. We'll just always * bounce it. */ if (!bounce && - ((what == MODE_ADD && add_listmode(&chptr->exlist, client, chptr, tmpstr)) - || (what == MODE_DEL && del_listmode(&chptr->exlist, chptr, tmpstr)))) + ((what == MODE_ADD && add_listmode(&channel->exlist, client, channel, tmpstr)) + || (what == MODE_DEL && del_listmode(&channel->exlist, channel, tmpstr)))) { break; /* already exists */ } @@ -1150,17 +1150,17 @@ process_listmode: if (!(p->options & EXTBOPT_INVEX)) break; /* this extended ban type does not support INVEX */ - if (p->is_ok && !p->is_ok(client, chptr, tmpstr, EXBCHK_ACCESS, what, EXBTYPE_EXCEPT)) + if (p->is_ok && !p->is_ok(client, channel, tmpstr, EXBCHK_ACCESS, what, EXBTYPE_EXCEPT)) { - if (ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,chptr,NULL)) + if (ValidatePermissionsForPath("channel:override:mode:extban",client,NULL,channel,NULL)) { /* TODO: send operoverride notice */ } else { - p->is_ok(client, chptr, tmpstr, EXBCHK_ACCESS_ERR, what, EXBTYPE_EXCEPT); + p->is_ok(client, channel, tmpstr, EXBCHK_ACCESS_ERR, what, EXBTYPE_EXCEPT); break; } } - if (p->is_ok && !p->is_ok(client, chptr, tmpstr, EXBCHK_PARAM, what, EXBTYPE_EXCEPT)) + if (p->is_ok && !p->is_ok(client, channel, tmpstr, EXBCHK_PARAM, what, EXBTYPE_EXCEPT)) break; } } @@ -1168,8 +1168,8 @@ process_listmode: * or not it exists on our server. We'll just always * bounce it. */ if (!bounce && - ((what == MODE_ADD && add_listmode(&chptr->invexlist, client, chptr, tmpstr)) - || (what == MODE_DEL && del_listmode(&chptr->invexlist, chptr, tmpstr)))) + ((what == MODE_ADD && add_listmode(&channel->invexlist, client, channel, tmpstr)) + || (what == MODE_DEL && del_listmode(&channel->invexlist, channel, tmpstr)))) { break; /* already exists */ } @@ -1186,7 +1186,7 @@ process_listmode: * note: if bounce is requested then the mode will not be set. * @returns amount of params eaten (0 or 1) */ -int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, +int do_extmode_char(Channel *channel, Cmode *handler, char *param, u_int what, Client *client, u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char bounce) { @@ -1208,19 +1208,19 @@ int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, if (MyUser(client)) { - x = handler->is_ok(client, chptr, mode, param, EXCHK_ACCESS, what); + x = handler->is_ok(client, channel, mode, param, EXCHK_ACCESS, what); if ((x == EX_ALWAYS_DENY) || - ((x == EX_DENY) && !op_can_override("channel:override:mode:del",client,chptr,handler) && !samode_in_progress)) + ((x == EX_DENY) && !op_can_override("channel:override:mode:del",client,channel,handler) && !samode_in_progress)) { - handler->is_ok(client, chptr, mode, param, EXCHK_ACCESS_ERR, what); + handler->is_ok(client, channel, mode, param, EXCHK_ACCESS_ERR, what); return paracnt; /* Denied & error msg sent */ } if (x == EX_DENY) opermode = 1; /* override in progress... */ } else { /* remote user: we only need to check if we need to generate an operoverride msg */ - if (!IsULine(client) && IsUser(client) && op_can_override("channel:override:mode:del",client,chptr,handler) && - (handler->is_ok(client, chptr, mode, param, EXCHK_ACCESS, what) != EX_ALLOW)) + if (!IsULine(client) && IsUser(client) && op_can_override("channel:override:mode:del",client,channel,handler) && + (handler->is_ok(client, channel, mode, param, EXCHK_ACCESS, what) != EX_ALLOW)) { opermode = 1; /* override in progress... */ } @@ -1244,7 +1244,7 @@ int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, { if (what == MODE_DEL) { - if (!(chptr->mode.extmode & handler->mode)) + if (!(channel->mode.extmode & handler->mode)) return paracnt; /* There's nothing to remove! */ if (handler->unset_with_param) { @@ -1252,7 +1252,7 @@ int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, * Any provided parameter is ok, the current one (that is set) will be used. */ ircsnprintf(pvar[*pcount], MODEBUFLEN + 3, "-%c%s", - handler->flag, cm_getparameter(chptr, handler->flag)); + handler->flag, cm_getparameter(channel, handler->flag)); (*pcount)++; } else { /* Normal extended channel mode: deleting is just -X, no parameter. @@ -1261,7 +1261,7 @@ int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, } } else { /* add: is the parameter ok? */ - if (handler->is_ok(client, chptr, mode, param, EXCHK_PARAM, what) == FALSE) + if (handler->is_ok(client, channel, mode, param, EXCHK_PARAM, what) == FALSE) return paracnt; /* rejected by is_ok */ morphed = handler->conv_param(param, client); @@ -1269,11 +1269,11 @@ int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, return paracnt; /* rejected by conv_param */ /* is it already set at the same value? if so, ignore it. */ - if (chptr->mode.extmode & handler->mode) + if (channel->mode.extmode & handler->mode) { char *now, *requested; char flag = handler->flag; - now = cm_getparameter(chptr, flag); + now = cm_getparameter(channel, flag); requested = handler->conv_param(param, client); if (now && requested && !strcmp(now, requested)) return paracnt; /* ignore... */ @@ -1290,15 +1290,15 @@ int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, if (what == MODE_ADD) { /* + */ - chptr->mode.extmode |= handler->mode; + channel->mode.extmode |= handler->mode; if (handler->paracount) - cm_putparameter(chptr, handler->flag, param); + cm_putparameter(channel, handler->flag, param); } else { /* - */ - chptr->mode.extmode &= ~(handler->mode); - RunHook2(HOOKTYPE_MODECHAR_DEL, chptr, (int)mode); + channel->mode.extmode &= ~(handler->mode); + RunHook2(HOOKTYPE_MODECHAR_DEL, channel, (int)mode); if (handler->paracount) - cm_freeparameter(chptr, handler->flag); + cm_freeparameter(channel, handler->flag); } return paracnt; } @@ -1372,7 +1372,7 @@ int paracount_for_chanmode(u_int what, char mode) /* set_mode * written by binary */ -void _set_mode(Channel *chptr, Client *client, int parc, char *parv[], u_int *pcount, +void _set_mode(Channel *channel, Client *client, int parc, char *parv[], u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce) { char *curchr; @@ -1396,14 +1396,14 @@ void _set_mode(Channel *chptr, Client *client, int parc, char *parv[], u_int *pc paracount = 1; *pcount = 0; - oldm = chptr->mode.mode; - oldl = chptr->mode.limit; - oldem = chptr->mode.extmode; - if (RESTRICT_CHANNELMODES && !ValidatePermissionsForPath("immune:restrict-channelmodes",client,NULL,chptr,NULL)) /* "cache" this */ + oldm = channel->mode.mode; + oldl = channel->mode.limit; + oldem = channel->mode.extmode; + if (RESTRICT_CHANNELMODES && !ValidatePermissionsForPath("immune:restrict-channelmodes",client,NULL,channel,NULL)) /* "cache" this */ checkrestr = 1; /* Set access to the status we have */ - my_access = IsUser(client) ? get_access(client, chptr) : 0; + my_access = IsUser(client) ? get_access(client, channel) : 0; for (curchr = parv[0]; *curchr; curchr++) { @@ -1416,11 +1416,11 @@ void _set_mode(Channel *chptr, Client *client, int parc, char *parv[], u_int *pc what = MODE_DEL; break; default: - if (MyUser(client) && chptr->mode_lock && strchr(chptr->mode_lock, *curchr) != NULL) + if (MyUser(client) && channel->mode_lock && strchr(channel->mode_lock, *curchr) != NULL) { if (!sent_mlock_warning) { - sendnumeric(client, ERR_MLOCKRESTRICTED, chptr->chname, *curchr, chptr->mode_lock); + sendnumeric(client, ERR_MLOCKRESTRICTED, channel->chname, *curchr, channel->mode_lock); sent_mlock_warning++; } continue; @@ -1504,20 +1504,20 @@ void _set_mode(Channel *chptr, Client *client, int parc, char *parv[], u_int *pc if (found == 1) { - paracount += do_mode_char(chptr, modetype, *curchr, + paracount += do_mode_char(channel, modetype, *curchr, argument, what, client, pcount, pvar, bounce, my_access); } else if (found == 2) { - paracount += do_extmode_char(chptr, &Channelmode_Table[extm], argument, + paracount += do_extmode_char(channel, &Channelmode_Table[extm], argument, what, client, pcount, pvar, bounce); } break; } /* switch(*curchr) */ } /* for loop through mode letters */ - make_mode_str(chptr, oldm, oldem, oldl, *pcount, pvar, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), bounce); + make_mode_str(channel, oldm, oldem, oldl, *pcount, pvar, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), bounce); #ifndef NO_OPEROVERRIDE if ((htrig == 1) && IsUser(client)) @@ -1527,13 +1527,13 @@ void _set_mode(Channel *chptr, Client *client, int parc, char *parv[], u_int *pc { sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) MODE %s %s %s", client->name, client->user->username, client->user->realhost, - chptr->chname, modebuf, parabuf); + channel->chname, modebuf, parabuf); } /* Logging Implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) MODE %s %s %s", client->name, client->user->username, client->user->realhost, - chptr->chname, modebuf, parabuf); + channel->chname, modebuf, parabuf); htrig = 0; opermode = 0; /* stop double override notices... but is this ok??? -- Syzop */ @@ -1883,7 +1883,7 @@ CMD_FUNC(_cmd_umode) CMD_FUNC(cmd_mlock) { - Channel *chptr = NULL; + Channel *channel = NULL; time_t t; if ((parc < 3) || BadPtr(parv[2])) @@ -1892,14 +1892,14 @@ CMD_FUNC(cmd_mlock) t = (time_t) atol(parv[1]); /* Now, try to find the channel in question */ - chptr = find_channel(parv[2], NULL); - if (!chptr) + channel = find_channel(parv[2], NULL); + if (!channel) return; /* Senders' Channel t is higher, drop it. */ - if (t > chptr->creationtime) + if (t > channel->creationtime) return; if (IsServer(client)) - set_channel_mlock(client, chptr, parv[3], TRUE); + set_channel_mlock(client, channel, parv[3], TRUE); } diff --git a/src/modules/names.c b/src/modules/names.c index 58a0a5737..62585df90 100644 --- a/src/modules/names.c +++ b/src/modules/names.c @@ -70,7 +70,7 @@ CMD_FUNC(cmd_names) int uhnames = (MyConnect(client) && HasCapability(client, "userhost-in-names")); // cache UHNAMES support int bufLen = NICKLEN + (!uhnames ? 0 : (1 + USERLEN + 1 + HOSTLEN)); int mlen = strlen(me.name) + bufLen + 7; - Channel *chptr; + Channel *channel; Client *acptr; int member; Member *cm; @@ -97,27 +97,27 @@ CMD_FUNC(cmd_names) } } - chptr = find_channel(para, NULL); + channel = find_channel(para, NULL); - if (!chptr || (!ShowChannel(client, chptr) && !ValidatePermissionsForPath("channel:see:names:secret",client,NULL,chptr,NULL))) + if (!channel || (!ShowChannel(client, channel) && !ValidatePermissionsForPath("channel:see:names:secret",client,NULL,channel,NULL))) { sendnumeric(client, RPL_ENDOFNAMES, para); return; } /* cache whether this user is a member of this channel or not */ - member = IsMember(client, chptr); + member = IsMember(client, channel); - if (PubChannel(chptr)) + if (PubChannel(channel)) buf[0] = '='; - else if (SecretChannel(chptr)) + else if (SecretChannel(channel)) buf[0] = '@'; else buf[0] = '*'; idx = 1; buf[idx++] = ' '; - for (s = chptr->chname; *s; s++) + for (s = channel->chname; *s; s++) buf[idx++] = *s; buf[idx++] = ' '; buf[idx++] = ':'; @@ -129,13 +129,13 @@ CMD_FUNC(cmd_names) spos = idx; /* starting point in buffer for names! */ - for (cm = chptr->members; cm; cm = cm->next) + for (cm = channel->members; cm; cm = cm->next) { acptr = cm->client; - if (IsInvisible(acptr) && !member && !ValidatePermissionsForPath("channel:see:names:invisible",client,acptr,chptr,NULL)) + if (IsInvisible(acptr) && !member && !ValidatePermissionsForPath("channel:see:names:invisible",client,acptr,channel,NULL)) continue; - if (!user_can_see_member(client, acptr, chptr)) + if (!user_can_see_member(client, acptr, channel)) continue; /* invisible (eg: due to delayjoin) */ if (!multiprefix) diff --git a/src/modules/nick.c b/src/modules/nick.c index e5fb3de45..637991d4d 100644 --- a/src/modules/nick.c +++ b/src/modules/nick.c @@ -233,7 +233,7 @@ void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Clien *p = '\0'; sendto_one(cptr, NULL, ":%s SJOIN %ld %s + :%s%s", - me.name, lp->chptr->creationtime, lp->chptr->chname, + me.name, lp->channel->creationtime, lp->channel->chname, flags, existing->name); } } @@ -895,21 +895,21 @@ CMD_FUNC(cmd_nick) { for (mp = client->user->channel; mp; mp = mp->next) { - if (!is_skochanop(client, mp->chptr) && is_banned(client, mp->chptr, BANCHK_NICK, NULL, NULL)) + if (!is_skochanop(client, mp->channel) && is_banned(client, mp->channel, BANCHK_NICK, NULL, NULL)) { sendnumeric(client, ERR_BANNICKCHANGE, - mp->chptr->chname); + mp->channel->chname); return; } - if (CHECK_TARGET_NICK_BANS && !is_skochanop(client, mp->chptr) && is_banned_with_nick(client, mp->chptr, BANCHK_NICK, nick, NULL, NULL)) + if (CHECK_TARGET_NICK_BANS && !is_skochanop(client, mp->channel) && is_banned_with_nick(client, mp->channel, BANCHK_NICK, nick, NULL, NULL)) { - sendnumeric(client, ERR_BANNICKCHANGE, mp->chptr->chname); + sendnumeric(client, ERR_BANNICKCHANGE, mp->channel->chname); return; } for (h = Hooks[HOOKTYPE_CHAN_PERMIT_NICK_CHANGE]; h; h = h->next) { - i = (*(h->func.intfunc))(client,mp->chptr); + i = (*(h->func.intfunc))(client,mp->channel); if (i != HOOK_CONTINUE) break; } @@ -917,7 +917,7 @@ CMD_FUNC(cmd_nick) if (i == HOOK_DENY) { sendnumeric(client, ERR_NONICKCHANGE, - mp->chptr->chname); + mp->channel->chname); return; } } diff --git a/src/modules/nocodes.c b/src/modules/nocodes.c index 48dee8fd8..b3d0a7d56 100644 --- a/src/modules/nocodes.c +++ b/src/modules/nocodes.c @@ -29,7 +29,7 @@ ModuleHeader MOD_HEADER "unrealircd-5", }; -char *nocodes_pre_chanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice); +char *nocodes_pre_chanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice); MOD_INIT() { @@ -57,17 +57,17 @@ static int has_controlcodes(char *p) return 0; } -char *nocodes_pre_chanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice) +char *nocodes_pre_chanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice) { static char retbuf[4096]; Hook *h; int i; - if (has_channel_mode(chptr, 'S')) + if (has_channel_mode(channel, 'S')) { for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, BYPASS_CHANMSG_COLOR); + i = (*(h->func.intfunc))(client, channel, BYPASS_CHANMSG_COLOR); if (i == HOOK_ALLOW) return text; /* bypass */ if (i != HOOK_CONTINUE) @@ -77,22 +77,22 @@ char *nocodes_pre_chanmsg(Client *client, Channel *chptr, MessageTag *mtags, cha strlcpy(retbuf, StripControlCodes(text), sizeof(retbuf)); return retbuf; } else - if (has_channel_mode(chptr, 'c')) + if (has_channel_mode(channel, 'c')) { if (has_controlcodes(text)) { for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { - i = (*(h->func.intfunc))(client, chptr, BYPASS_CHANMSG_COLOR); + i = (*(h->func.intfunc))(client, channel, BYPASS_CHANMSG_COLOR); if (i == HOOK_ALLOW) return text; /* bypass */ if (i != HOOK_CONTINUE) break; } - sendnumeric(client, ERR_CANNOTSENDTOCHAN, chptr->chname, + sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->chname, "Control codes (bold/underline/reverse) are not permitted in this channel", - chptr->chname); + channel->chname); return NULL; } else return text; diff --git a/src/modules/part.c b/src/modules/part.c index ca2fd0855..140b75e23 100644 --- a/src/modules/part.c +++ b/src/modules/part.c @@ -59,7 +59,7 @@ MOD_UNLOAD() */ CMD_FUNC(cmd_part) { - Channel *chptr; + Channel *channel; Membership *lp; char *p = NULL, *name; char *commentx = (parc > 2 && parv[2]) ? parv[2] : NULL; @@ -106,8 +106,8 @@ CMD_FUNC(cmd_part) break; } - chptr = get_channel(client, name, 0); - if (!chptr) + channel = get_channel(client, name, 0); + if (!channel) { sendnumeric(client, ERR_NOSUCHCHANNEL, name); continue; @@ -119,7 +119,7 @@ CMD_FUNC(cmd_part) */ comment = commentx; - if (!(lp = find_membership_link(client->user->channel, chptr))) + if (!(lp = find_membership_link(client->user->channel, channel))) { /* Normal to get get when our client did a kick ** for a remote client (who sends back a PART), @@ -130,15 +130,15 @@ CMD_FUNC(cmd_part) continue; } - if (!ValidatePermissionsForPath("channel:override:banpartmsg",client,NULL,chptr,NULL) && !is_chan_op(client, chptr)) { + if (!ValidatePermissionsForPath("channel:override:banpartmsg",client,NULL,channel,NULL) && !is_chan_op(client, channel)) { /* Banned? No comment allowed ;) */ - if (comment && is_banned(client, chptr, BANCHK_MSG, &comment, NULL)) + if (comment && is_banned(client, channel, BANCHK_MSG, &comment, NULL)) comment = NULL; - if (comment && is_banned(client, chptr, BANCHK_LEAVE_MSG, &comment, NULL)) + if (comment && is_banned(client, channel, BANCHK_LEAVE_MSG, &comment, NULL)) comment = NULL; /* Same for +m */ - if ((chptr->mode.mode & MODE_MODERATED) && comment && - !has_voice(client, chptr) && !is_half_op(client, chptr)) + if ((channel->mode.mode & MODE_MODERATED) && comment && + !has_voice(client, channel) && !is_half_op(client, channel)) { comment = NULL; } @@ -148,50 +148,50 @@ CMD_FUNC(cmd_part) { Hook *tmphook; for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_PART]; tmphook; tmphook = tmphook->next) { - comment = (*(tmphook->func.pcharfunc))(client, chptr, comment); + comment = (*(tmphook->func.pcharfunc))(client, channel, comment); if (!comment) break; } } /* Create a new message, this one is actually used by 8 calls (though at most 4 max) */ - new_message_special(client, recv_mtags, &mtags, ":%s PART %s", client->name, chptr->chname); + new_message_special(client, recv_mtags, &mtags, ":%s PART %s", client->name, channel->chname); /* Send to other servers... */ sendto_server(client, PROTO_SID, 0, mtags, ":%s PART %s :%s", - ID(client), chptr->chname, comment ? comment : ""); + ID(client), channel->chname, comment ? comment : ""); sendto_server(client, 0, PROTO_SID, mtags, ":%s PART %s :%s", - client->name, chptr->chname, comment ? comment : ""); + client->name, channel->chname, comment ? comment : ""); - if (invisible_user_in_channel(client, chptr)) + if (invisible_user_in_channel(client, channel)) { /* Show PART only to chanops and self */ if (!comment) { - sendto_channel(chptr, client, client, + sendto_channel(channel, client, client, CHFL_HALFOP|CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN, 0, SEND_LOCAL, mtags, ":%s PART %s", - client->name, chptr->chname); + client->name, channel->chname); if (MyUser(client)) { sendto_one(client, mtags, ":%s!%s@%s PART %s", - client->name, client->user->username, GetHost(client), chptr->chname); + client->name, client->user->username, GetHost(client), channel->chname); } } else { - sendto_channel(chptr, client, client, + sendto_channel(channel, client, client, CHFL_HALFOP|CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN, 0, SEND_LOCAL, mtags, ":%s PART %s %s", - client->name, chptr->chname, comment); + client->name, channel->chname, comment); if (MyUser(client)) { sendto_one(client, mtags, ":%s!%s@%s PART %s %s", client->name, client->user->username, GetHost(client), - chptr->chname, comment); + channel->chname, comment); } } } @@ -200,23 +200,23 @@ CMD_FUNC(cmd_part) /* Show PART to all users in channel */ if (!comment) { - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s PART %s", - client->name, chptr->chname); + client->name, channel->chname); } else { - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s PART %s :%s", - client->name, chptr->chname, comment); + client->name, channel->chname, comment); } } if (MyUser(client)) - RunHook4(HOOKTYPE_LOCAL_PART, client, chptr, mtags, comment); + RunHook4(HOOKTYPE_LOCAL_PART, client, channel, mtags, comment); else - RunHook4(HOOKTYPE_REMOTE_PART, client, chptr, mtags, comment); + RunHook4(HOOKTYPE_REMOTE_PART, client, channel, mtags, comment); free_message_tags(mtags); - remove_user_from_channel(client, chptr); + remove_user_from_channel(client, channel); } } diff --git a/src/modules/quit.c b/src/modules/quit.c index 25c9ad9df..34ef41907 100644 --- a/src/modules/quit.c +++ b/src/modules/quit.c @@ -93,22 +93,22 @@ CMD_FUNC(cmd_quit) { Membership *lp, *lp_next; char *newcomment; - Channel *chptr; + Channel *channel; for (lp = client->user->channel; lp; lp = lp_next) { - chptr = lp->chptr; + channel = lp->channel; newcomment = comment; lp_next = lp->next; for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_QUIT_CHAN]; tmphook; tmphook = tmphook->next) { - newcomment = (*(tmphook->func.pcharfunc))(client, chptr, comment); + newcomment = (*(tmphook->func.pcharfunc))(client, channel, comment); if (!newcomment) break; } - if (newcomment && is_banned(client, chptr, BANCHK_LEAVE_MSG, &newcomment, NULL)) + if (newcomment && is_banned(client, channel, BANCHK_LEAVE_MSG, &newcomment, NULL)) newcomment = NULL; /* Comment changed? Then PART the user before we do the QUIT. */ @@ -118,7 +118,7 @@ CMD_FUNC(cmd_quit) int ret; parx[0] = NULL; - parx[1] = chptr->chname; + parx[1] = channel->chname; parx[2] = newcomment; parx[3] = NULL; diff --git a/src/modules/restrict-commands.c b/src/modules/restrict-commands.c index e73cf6ad8..044af0d74 100644 --- a/src/modules/restrict-commands.c +++ b/src/modules/restrict-commands.c @@ -51,7 +51,7 @@ RestrictedCommand *find_restrictions_bycmd(char *cmd); RestrictedCommand *find_restrictions_byconftag(char *conftag); int rcmd_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs); int rcmd_configrun(ConfigFile *cf, ConfigEntry *ce, int type); -char *rcmd_hook_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice); +char *rcmd_hook_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice); char *rcmd_hook_preusermsg(Client *client, Client *to, char *text, int notice); char *rcmd_hook_wrapper(Client *client, char *text, int notice, char *display, char *conftag); CMD_OVERRIDE_FUNC(rcmd_override); @@ -306,7 +306,7 @@ int rcmd_canbypass(Client *client, RestrictedCommand *rcmd) { return 1; // Default to yes so we don't drop too many commands } -char *rcmd_hook_prechanmsg(Client *client, Channel *chptr, MessageTag *mtags, char *text, int notice) +char *rcmd_hook_prechanmsg(Client *client, Channel *channel, MessageTag *mtags, char *text, int notice) { return rcmd_hook_wrapper(client, text, notice, "channel", (notice ? "channel-notice" : "channel-message")); } diff --git a/src/modules/sajoin.c b/src/modules/sajoin.c index 258a6eb73..f15b3a7a9 100644 --- a/src/modules/sajoin.c +++ b/src/modules/sajoin.c @@ -113,7 +113,7 @@ CMD_FUNC(cmd_sajoin) /* Now works like cmd_join */ for (i = 0, name = strtoken(&p, parv[2], ","); name; name = strtoken(&p, NULL, ",")) { - Channel *chptr; + Channel *channel; Membership *lp; if (++ntargets > maxtargets) @@ -172,16 +172,16 @@ CMD_FUNC(cmd_sajoin) continue; } - chptr = get_channel(target, name, 0); + channel = get_channel(target, name, 0); /* If this _specific_ channel is not permitted, skip it */ - if (!IsULine(client) && !ValidatePermissionsForPath("sacmd:sajoin",client,target,chptr,NULL)) + if (!IsULine(client) && !ValidatePermissionsForPath("sacmd:sajoin",client,target,channel,NULL)) { sendnumeric(client, ERR_NOPRIVILEGES); continue; } - if (!parted && chptr && (lp = find_membership_link(target->user->channel, chptr))) + if (!parted && channel && (lp = find_membership_link(target->user->channel, channel))) { sendnumeric(client, ERR_USERONCHANNEL, parv[1], name); continue; @@ -200,7 +200,7 @@ CMD_FUNC(cmd_sajoin) { MessageTag *mtags = NULL; int flags; - Channel *chptr; + Channel *channel; Membership *lp; Hook *h; int i = 0; @@ -214,30 +214,30 @@ CMD_FUNC(cmd_sajoin) while ((lp = target->user->channel)) { MessageTag *mtags = NULL; - chptr = lp->chptr; + channel = lp->channel; new_message(target, NULL, &mtags); - sendto_channel(chptr, target, NULL, 0, 0, SEND_LOCAL, NULL, + sendto_channel(channel, target, NULL, 0, 0, SEND_LOCAL, NULL, ":%s PART %s :%s", - target->name, chptr->chname, "Left all channels"); - sendto_server(client, 0, 0, mtags, ":%s PART %s :Left all channels", target->name, chptr->chname); + target->name, channel->chname, "Left all channels"); + sendto_server(client, 0, 0, mtags, ":%s PART %s :Left all channels", target->name, channel->chname); if (MyConnect(target)) - RunHook4(HOOKTYPE_LOCAL_PART, target, chptr, mtags, "Left all channels"); + RunHook4(HOOKTYPE_LOCAL_PART, target, channel, mtags, "Left all channels"); free_message_tags(mtags); - remove_user_from_channel(target, chptr); + remove_user_from_channel(target, channel); } strcpy(jbuf, "0"); continue; } flags = (ChannelExists(name)) ? CHFL_DEOPPED : LEVEL_ON_JOIN; - chptr = get_channel(target, name, CREATE); - if (chptr && (lp = find_membership_link(target->user->channel, chptr))) + channel = get_channel(target, name, CREATE); + if (channel && (lp = find_membership_link(target->user->channel, channel))) continue; i = HOOK_CONTINUE; for (h = Hooks[HOOKTYPE_CAN_SAJOIN]; h; h = h->next) { - i = (*(h->func.intfunc))(target,chptr,client); + i = (*(h->func.intfunc))(target,channel,client); if (i != HOOK_CONTINUE) break; } @@ -251,7 +251,7 @@ CMD_FUNC(cmd_sajoin) * Each with their own unique msgid. */ new_message(target, NULL, &mtags); - join_channel(chptr, target, mtags, flags); + join_channel(channel, target, mtags, flags); if (sjmode) { opermode = 0; @@ -261,7 +261,7 @@ CMD_FUNC(cmd_sajoin) mode_args[0][1] = '\0'; mode_args[1] = target->name; mode_args[2] = 0; - (void)do_mode(chptr, target, NULL, 3, mode_args, 0, 1); + (void)do_mode(channel, target, NULL, 3, mode_args, 0, 1); sajoinmode = 0; safe_free(mode_args[0]); } diff --git a/src/modules/samode.c b/src/modules/samode.c index 4aab15002..d02dd359f 100644 --- a/src/modules/samode.c +++ b/src/modules/samode.c @@ -60,7 +60,7 @@ MOD_UNLOAD() */ CMD_FUNC(cmd_samode) { - Channel *chptr; + Channel *channel; if (parc <= 2) { @@ -68,19 +68,19 @@ CMD_FUNC(cmd_samode) return; } - chptr = find_channel(parv[1], NULL); - if (!chptr) + channel = find_channel(parv[1], NULL); + if (!channel) { sendnumeric(client, ERR_NOSUCHCHANNEL, parv[1]); return; } - if (!ValidatePermissionsForPath("sacmd:samode", client, NULL, chptr, NULL)) + if (!ValidatePermissionsForPath("sacmd:samode", client, NULL, channel, NULL)) { sendnumeric(client, ERR_NOPRIVILEGES); return; } opermode = 0; - (void)do_mode(chptr, client, NULL, parc - 2, parv + 2, 0, 1); + (void)do_mode(channel, client, NULL, parc - 2, parv + 2, 0, 1); } diff --git a/src/modules/sapart.c b/src/modules/sapart.c index 838b572e4..198f5edd9 100644 --- a/src/modules/sapart.c +++ b/src/modules/sapart.c @@ -64,7 +64,7 @@ MOD_UNLOAD() CMD_FUNC(cmd_sapart) { Client *target; - Channel *chptr; + Channel *channel; Membership *lp; char *name, *p = NULL; int i; @@ -106,7 +106,7 @@ CMD_FUNC(cmd_sapart) sendnumeric(client, ERR_TOOMANYTARGETS, name, maxtargets, "SAPART"); break; } - if (!(chptr = get_channel(target, name, 0))) + if (!(channel = get_channel(target, name, 0))) { sendnumeric(client, ERR_NOSUCHCHANNEL, name); @@ -114,13 +114,13 @@ CMD_FUNC(cmd_sapart) } /* Validate oper can do this on chan/victim */ - if (!IsULine(client) && !ValidatePermissionsForPath("sacmd:sapart",client,target,chptr,NULL)) + if (!IsULine(client) && !ValidatePermissionsForPath("sacmd:sapart",client,target,channel,NULL)) { sendnumeric(client, ERR_NOPRIVILEGES); continue; } - if (!(lp = find_membership_link(target->user->channel, chptr))) + if (!(lp = find_membership_link(target->user->channel, channel))) { sendnumeric(client, ERR_USERNOTINCHANNEL, parv[1], name); diff --git a/src/modules/server.c b/src/modules/server.c index 4bd6edd5a..f772dbb93 100644 --- a/src/modules/server.c +++ b/src/modules/server.c @@ -23,9 +23,9 @@ #include "unrealircd.h" /* Forward declarations */ -void send_channel_modes(Client *to, Channel *chptr); -void send_channel_modes_sjoin(Client *to, Channel *chptr); -void send_channel_modes_sjoin3(Client *to, Channel *chptr); +void send_channel_modes(Client *to, Channel *channel); +void send_channel_modes_sjoin(Client *to, Channel *channel); +void send_channel_modes_sjoin3(Client *to, Channel *channel); CMD_FUNC(cmd_server); CMD_FUNC(cmd_server_remote); int _verify_link(Client *client, char *servername, ConfigItem_link **link_out); @@ -1055,22 +1055,22 @@ int server_sync(Client *cptr, ConfigItem_link *aconf) ** Last, pass all channels plus statuses */ { - Channel *chptr; - for (chptr = channels; chptr; chptr = chptr->nextch) + Channel *channel; + for (channel = channels; channel; channel = channel->nextch) { if (!SupportSJOIN(cptr)) - send_channel_modes(cptr, chptr); + send_channel_modes(cptr, channel); else if (SupportSJOIN(cptr) && !SupportSJ3(cptr)) { - send_channel_modes_sjoin(cptr, chptr); + send_channel_modes_sjoin(cptr, channel); } else - send_channel_modes_sjoin3(cptr, chptr); - if (chptr->topic_time) + send_channel_modes_sjoin3(cptr, channel); + if (channel->topic_time) sendto_one(cptr, NULL, "TOPIC %s %s %lld :%s", - chptr->chname, chptr->topic_nick, - (long long)chptr->topic_time, chptr->topic); - send_moddata_channel(cptr, chptr); + channel->chname, channel->topic_nick, + (long long)channel->topic_time, channel->topic); + send_moddata_channel(cptr, channel); } } @@ -1102,7 +1102,7 @@ int server_sync(Client *cptr, ConfigItem_link *aconf) * Previously this function was called send_mode_list() when it was dual-function. * (only for old severs lacking SJOIN/SJ3 */ -static void send_channel_modes_members(Client *to, Channel *chptr, int mask, char flag) +static void send_channel_modes_members(Client *to, Channel *channel, int mask, char flag) { Member *lp; char *cp, *name; @@ -1111,7 +1111,7 @@ static void send_channel_modes_members(Client *to, Channel *chptr, int mask, cha cp = modebuf + strlen(modebuf); if (*parabuf) /* mode +l or +k xx */ count = 1; - for (lp = chptr->members; lp; lp = lp->next) + for (lp = channel->members; lp; lp = lp->next) { if (!(lp->flags & mask)) continue; @@ -1134,7 +1134,7 @@ static void send_channel_modes_members(Client *to, Channel *chptr, int mask, cha if (send) { /* to is always a server! So we send creationtime */ - sendmodeto_one(to, me.name, chptr->chname, modebuf, parabuf, chptr->creationtime); + sendmodeto_one(to, me.name, channel->chname, modebuf, parabuf, channel->creationtime); send = 0; *parabuf = '\0'; cp = modebuf; @@ -1154,7 +1154,7 @@ static void send_channel_modes_members(Client *to, Channel *chptr, int mask, cha * Previously this was combined with +vhoaq stuff in the send_mode_list() function. * (only for old severs lacking SJOIN/SJ3 */ -static void send_channel_modes_list_mode(Client *to, Channel *chptr, Ban *lp, char flag) +static void send_channel_modes_list_mode(Client *to, Channel *channel, Ban *lp, char flag) { char *cp, *name; int count = 0, send = 0; @@ -1186,7 +1186,7 @@ static void send_channel_modes_list_mode(Client *to, Channel *chptr, Ban *lp, ch if (send) { /* to is always a server! So we send creationtime */ - sendmodeto_one(to, me.name, chptr->chname, modebuf, parabuf, chptr->creationtime); + sendmodeto_one(to, me.name, channel->chname, modebuf, parabuf, channel->creationtime); send = 0; *parabuf = '\0'; cp = modebuf; @@ -1203,61 +1203,61 @@ static void send_channel_modes_list_mode(Client *to, Channel *chptr, Ban *lp, ch } /* (only for old severs lacking SJOIN/SJ3 */ -static inline void send_channel_mode(Client *to, char *from, Channel *chptr) +static inline void send_channel_mode(Client *to, char *from, Channel *channel) { if (*parabuf) sendto_one(to, NULL, ":%s MODE %s %s %s %lld", from, - chptr->chname, - modebuf, parabuf, (long long)chptr->creationtime); + channel->chname, + modebuf, parabuf, (long long)channel->creationtime); else sendto_one(to, NULL, ":%s MODE %s %s %lld", from, - chptr->chname, - modebuf, (long long)chptr->creationtime); + channel->chname, + modebuf, (long long)channel->creationtime); } -/** Send "to" a full list of the MODEs for channel chptr. +/** Send "to" a full list of the MODEs for channel channel. * Note that this function is only used for servers lacking SJOIN/SJOIN3. */ -void send_channel_modes(Client *to, Channel *chptr) +void send_channel_modes(Client *to, Channel *channel) { - if (*chptr->chname != '#') + if (*channel->chname != '#') return; /* Send the "property" channel modes like +lks */ *modebuf = *parabuf = '\0'; - channel_modes(to, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr); - send_channel_mode(to, me.name, chptr); + channel_modes(to, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel); + send_channel_mode(to, me.name, channel); /* Then send the +qaohv in one go */ modebuf[0] = '+'; modebuf[1] = '\0'; parabuf[0] = '\0'; - send_channel_modes_members(to, chptr, CHFL_CHANOWNER, 'q'); - send_channel_modes_members(to, chptr, CHFL_CHANADMIN, 'a'); - send_channel_modes_members(to, chptr, CHFL_CHANOP, 'o'); - send_channel_modes_members(to, chptr, CHFL_HALFOP, 'h'); - send_channel_modes_members(to, chptr, CHFL_VOICE, 'v'); + send_channel_modes_members(to, channel, CHFL_CHANOWNER, 'q'); + send_channel_modes_members(to, channel, CHFL_CHANADMIN, 'a'); + send_channel_modes_members(to, channel, CHFL_CHANOP, 'o'); + send_channel_modes_members(to, channel, CHFL_HALFOP, 'h'); + send_channel_modes_members(to, channel, CHFL_VOICE, 'v'); /* ..including any remainder in the buffer.. */ if (modebuf[1] || *parabuf) - sendmodeto_one(to, me.name, chptr->chname, modebuf, parabuf, chptr->creationtime); + sendmodeto_one(to, me.name, channel->chname, modebuf, parabuf, channel->creationtime); /* Then send the +beI in one go */ modebuf[0] = '+'; modebuf[1] = '\0'; parabuf[0] = '\0'; - send_channel_modes_list_mode(to, chptr, chptr->banlist, 'b'); - send_channel_modes_list_mode(to, chptr, chptr->exlist, 'e'); - send_channel_modes_list_mode(to, chptr, chptr->invexlist, 'I'); + send_channel_modes_list_mode(to, channel, channel->banlist, 'b'); + send_channel_modes_list_mode(to, channel, channel->exlist, 'e'); + send_channel_modes_list_mode(to, channel, channel->invexlist, 'I'); /* ..including any remainder in the buffer.. */ if (modebuf[1] || *parabuf) - sendmodeto_one(to, me.name, chptr->chname, modebuf, parabuf, chptr->creationtime); + sendmodeto_one(to, me.name, channel->chname, modebuf, parabuf, channel->creationtime); /* send MLOCK here too... --nenolod */ if (CHECKPROTO(to, PROTO_MLOCK)) { sendto_one(to, NULL, "MLOCK %lld %s :%s", - (long long)chptr->creationtime, chptr->chname, - BadPtr(chptr->mode_lock) ? "" : chptr->mode_lock); + (long long)channel->creationtime, channel->chname, + BadPtr(channel->mode_lock) ? "" : channel->mode_lock); } } @@ -1389,10 +1389,10 @@ static int send_ban_list(Client *to, char *chname, time_t creationtime, Channel /* - * This will send "to" a full list of the modes for channel chptr, + * This will send "to" a full list of the modes for channel channel, * NOTE: this is only for old servers who do not support SJ3. */ -void send_channel_modes_sjoin(Client *to, Channel *chptr) +void send_channel_modes_sjoin(Client *to, Channel *channel) { Member *members; Member *lp; @@ -1401,15 +1401,15 @@ void send_channel_modes_sjoin(Client *to, Channel *chptr) int n = 0; - if (*chptr->chname != '#') + if (*channel->chname != '#') return; - members = chptr->members; + members = channel->members; /* First we'll send channel, channel modes and members and status */ *modebuf = *parabuf = '\0'; - channel_modes(to, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr); + channel_modes(to, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel); if (*parabuf) { @@ -1423,7 +1423,7 @@ void send_channel_modes_sjoin(Client *to, Channel *chptr) } ircsnprintf(buf, sizeof(buf), "SJOIN %lld %s %s %s :", - (long long)chptr->creationtime, chptr->chname, modebuf, parabuf); + (long long)channel->creationtime, channel->chname, modebuf, parabuf); bufptr = buf + strlen(buf); @@ -1460,7 +1460,7 @@ void send_channel_modes_sjoin(Client *to, Channel *chptr) sendto_one(to, NULL, "%s", buf); ircsnprintf(buf, sizeof(buf), "SJOIN %lld %s %s %s :", - (long long)chptr->creationtime, chptr->chname, modebuf, + (long long)channel->creationtime, channel->chname, modebuf, parabuf); n = 0; @@ -1479,23 +1479,23 @@ void send_channel_modes_sjoin(Client *to, Channel *chptr) *parabuf = '\0'; *modebuf = '+'; modebuf[1] = '\0'; - send_ban_list(to, chptr->chname, chptr->creationtime, chptr); + send_ban_list(to, channel->chname, channel->creationtime, channel); if (modebuf[1] || *parabuf) sendto_one(to, NULL, "MODE %s %s %s %lld", - chptr->chname, modebuf, parabuf, - (long long)chptr->creationtime); + channel->chname, modebuf, parabuf, + (long long)channel->creationtime); return; } -/** This will send "to" a full list of the modes for channel chptr, +/** This will send "to" a full list of the modes for channel channel, * * Half of it recoded by Syzop: the whole buffering and size checking stuff * looked weird and just plain inefficient. We now fill up our send-buffer * really as much as we can, without causing any overflows of course. */ -void send_channel_modes_sjoin3(Client *to, Channel *chptr) +void send_channel_modes_sjoin3(Client *to, Channel *channel) { MessageTag *mtags = NULL; Member *members; @@ -1509,17 +1509,17 @@ void send_channel_modes_sjoin3(Client *to, Channel *chptr) int prebuflen = 0; /* points to after the > : part */ int sent = 0; /* we need this so we send at least 1 message about the channel (eg if +P and no members, no bans, #4459) */ - if (*chptr->chname != '#') + if (*channel->chname != '#') return; nomode = 0; nopara = 0; - members = chptr->members; + members = channel->members; /* First we'll send channel, channel modes and members and status */ *modebuf = *parabuf = '\0'; - channel_modes(to, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr); + channel_modes(to, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel); if (!modebuf[1]) nomode = 1; @@ -1538,19 +1538,19 @@ void send_channel_modes_sjoin3(Client *to, Channel *chptr) { ircsnprintf(buf, sizeof(buf), ":%s SJOIN %lld %s :", CHECKPROTO(to, PROTO_SID) ? me.id : me.name, - (long long)chptr->creationtime, chptr->chname); + (long long)channel->creationtime, channel->chname); } if (nopara && !nomode) { ircsnprintf(buf, sizeof(buf), ":%s SJOIN %lld %s %s :", CHECKPROTO(to, PROTO_SID) ? me.id : me.name, - (long long)chptr->creationtime, chptr->chname, modebuf); + (long long)channel->creationtime, channel->chname, modebuf); } if (!nopara && !nomode) { ircsnprintf(buf, sizeof(buf), ":%s SJOIN %lld %s %s %s :", CHECKPROTO(to, PROTO_SID) ? me.id : me.name, - (long long)chptr->creationtime, chptr->chname, modebuf, parabuf); + (long long)channel->creationtime, channel->chname, modebuf, parabuf); } prebuflen = strlen(buf); @@ -1609,7 +1609,7 @@ void send_channel_modes_sjoin3(Client *to, Channel *chptr) bufptr = mystpcpy(bufptr, tbuf); } - for (ban = chptr->banlist; ban; ban = ban->next) + for (ban = channel->banlist; ban; ban = ban->next) { p = tbuf; if (SupportSJSBY(to)) @@ -1632,7 +1632,7 @@ void send_channel_modes_sjoin3(Client *to, Channel *chptr) bufptr = mystpcpy(bufptr, tbuf); } - for (ban = chptr->exlist; ban; ban = ban->next) + for (ban = channel->exlist; ban; ban = ban->next) { p = tbuf; if (SupportSJSBY(to)) @@ -1655,7 +1655,7 @@ void send_channel_modes_sjoin3(Client *to, Channel *chptr) bufptr = mystpcpy(bufptr, tbuf); } - for (ban = chptr->invexlist; ban; ban = ban->next) + for (ban = channel->invexlist; ban; ban = ban->next) { p = tbuf; if (SupportSJSBY(to)) diff --git a/src/modules/sjoin.c b/src/modules/sjoin.c index e8e132dd8..47961cbac 100644 --- a/src/modules/sjoin.c +++ b/src/modules/sjoin.c @@ -116,11 +116,11 @@ aParv *mp2parv(char *xmbuf, char *parmbuf) else {\ MessageTag *mtags = NULL; \ /* for old servers without sjoin: */ \ - sendto_server(client, 0, PROTO_SJOIN, NULL, ":%s MODE %s %s %s %lld", client->name, chptr->chname,\ - modebuf, parabuf, (long long)chptr->creationtime); \ - new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, chptr->chname, modebuf, parabuf); \ - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, \ - ":%s MODE %s %s %s", client->name, chptr->chname, modebuf, parabuf); \ + sendto_server(client, 0, PROTO_SJOIN, NULL, ":%s MODE %s %s %s %lld", client->name, channel->chname,\ + modebuf, parabuf, (long long)channel->creationtime); \ + new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf); \ + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, \ + ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf); \ free_message_tags(mtags); \ strcpy(parabuf,param);\ /* modebuf[0] should stay what it was ('+' or '-') */ \ @@ -148,7 +148,7 @@ CMD_FUNC(cmd_sjoin) char uid_sjsby_buf[BUFSIZE]; /**< Buffer for server-to-server traffic which will be broadcasted to others (servers supporting SID/UID and SJSBY) */ char sj3_parabuf[BUFSIZE]; /**< Prefix for the above SJOIN buffers (":xxx SJOIN #channel +mode :") */ char *s = NULL; - Channel *chptr; /**< Channel */ + Channel *channel; /**< Channel */ aParv *ap; int pcount, i; Hook *h; @@ -186,33 +186,33 @@ CMD_FUNC(cmd_sjoin) nomode = 1; } - chptr = get_channel(client, parv[2], CREATE); + channel = get_channel(client, parv[2], CREATE); ts = (time_t)atol(parv[1]); - if (chptr->creationtime > ts) + if (channel->creationtime > ts) { removeours = 1; - oldts = chptr->creationtime; - chptr->creationtime = ts; + oldts = channel->creationtime; + channel->creationtime = ts; } - else if ((chptr->creationtime < ts) && (chptr->creationtime != 0)) + else if ((channel->creationtime < ts) && (channel->creationtime != 0)) { removetheirs = 1; } - else if (chptr->creationtime == ts) + else if (channel->creationtime == ts) { merge = 1; } - if (chptr->creationtime == 0) + if (channel->creationtime == 0) { oldts = -1; - chptr->creationtime = ts; + channel->creationtime = ts; } else { - oldts = chptr->creationtime; + oldts = channel->creationtime; } // FIXME: make it so services cannot screw this up so easily --- if possible... @@ -221,7 +221,7 @@ CMD_FUNC(cmd_sjoin) if (ts != 0) sendto_ops ("Warning! Possible desynch: SJOIN for channel %s has a fishy timestamp (%lld) [%s/%s]", - chptr->chname, (long long)ts, client->name, client->direction->name); + channel->chname, (long long)ts, client->name, client->direction->name); } parabuf[0] = '\0'; @@ -229,7 +229,7 @@ CMD_FUNC(cmd_sjoin) modebuf[1] = '\0'; /* Grab current modes -> modebuf & parabuf */ - channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr); + channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel); /* Do we need to remove all our modes, bans/exempt/inves lists and -vhoaq our users? */ if (removeours) @@ -244,19 +244,19 @@ CMD_FUNC(cmd_sjoin) { MessageTag *mtags = NULL; ap = mp2parv(modebuf, parabuf); - set_mode(chptr, client, ap->parc, ap->parv, &pcount, pvar, 0); + set_mode(channel, client, ap->parc, ap->parv, &pcount, pvar, 0); /* for old servers without SJOIN: */ sendto_server(client, 0, PROTO_SJOIN, mtags, ":%s MODE %s %s %s %lld", - client->name, chptr->chname, modebuf, parabuf, - (long long)chptr->creationtime); + client->name, channel->chname, modebuf, parabuf, + (long long)channel->creationtime); /* send to all local users: */ - new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, chptr->chname, modebuf, parabuf); - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf); + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", - client->name, chptr->chname, modebuf, parabuf); + client->name, channel->chname, modebuf, parabuf); free_message_tags(mtags); } /* remove bans */ @@ -265,39 +265,39 @@ CMD_FUNC(cmd_sjoin) modebuf[1] = '\0'; parabuf[0] = '\0'; b = 1; - while(chptr->banlist) + while(channel->banlist) { - Ban *ban = chptr->banlist; + Ban *ban = channel->banlist; Addit('b', ban->banstr); - chptr->banlist = ban->next; + channel->banlist = ban->next; safe_free(ban->banstr); safe_free(ban->who); free_ban(ban); } - while(chptr->exlist) + while(channel->exlist) { - Ban *ban = chptr->exlist; + Ban *ban = channel->exlist; Addit('e', ban->banstr); - chptr->exlist = ban->next; + channel->exlist = ban->next; safe_free(ban->banstr); safe_free(ban->who); free_ban(ban); } - while(chptr->invexlist) + while(channel->invexlist) { - Ban *ban = chptr->invexlist; + Ban *ban = channel->invexlist; Addit('I', ban->banstr); - chptr->invexlist = ban->next; + channel->invexlist = ban->next; safe_free(ban->banstr); safe_free(ban->who); free_ban(ban); } - for (lp = chptr->members; lp; lp = lp->next) + for (lp = channel->members; lp; lp = lp->next) { - lp2 = find_membership_link(lp->client->user->channel, chptr); + lp2 = find_membership_link(lp->client->user->channel, channel); if (!lp2) { - sendto_realops("Oops! chptr->members && !find_membership_link"); + sendto_realops("Oops! channel->members && !find_membership_link"); continue; } if (lp->flags & MODE_CHANOWNER) @@ -337,19 +337,19 @@ CMD_FUNC(cmd_sjoin) /* for old servers without sjoin: */ sendto_server(client, 0, PROTO_SJOIN, mtags, ":%s MODE %s %s %s %lld", - client->name, chptr->chname, - modebuf, parabuf, (long long)chptr->creationtime); + client->name, channel->chname, + modebuf, parabuf, (long long)channel->creationtime); /* send to all local users: */ - new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, chptr->chname, modebuf, parabuf); - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf); + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", - client->name, chptr->chname, modebuf, parabuf); + client->name, channel->chname, modebuf, parabuf); free_message_tags(mtags); } /* since we're dropping our modes, we want to clear the mlock as well. --nenolod */ - set_channel_mlock(client, chptr, NULL, FALSE); + set_channel_mlock(client, channel, NULL, FALSE); } /* Mode setting done :), now for our beloved clients */ parabuf[0] = 0; @@ -401,7 +401,7 @@ CMD_FUNC(cmd_sjoin) { /* this obviously should never happen */ sendto_ops("Malformed SJOIN piece from %s for channel %s: %s", - client->name, chptr->chname, tp); + client->name, channel->chname, tp); continue; } *end++ = '\0'; @@ -411,7 +411,7 @@ CMD_FUNC(cmd_sjoin) { /* missing setby parameter */ sendto_ops("Malformed SJOIN piece from %s for channel %s: %s", - client->name, chptr->chname, tp); + client->name, channel->chname, tp); continue; } *p++ = '\0'; @@ -513,7 +513,7 @@ getnick: if (acptr->direction != client->direction) { - if (IsMember(acptr, chptr)) + if (IsMember(acptr, channel)) { /* Nick collision, don't kick or it desynchs -Griever*/ continue; @@ -521,12 +521,12 @@ getnick: sendto_one(client, NULL, ":%s KICK %s %s :Fake direction", - me.name, chptr->chname, + me.name, channel->chname, acptr->name); sendto_realops ("Fake direction from user %s in SJOIN from %s(%s) at %s", nick, client->srvptr->name, - client->name, chptr->chname); + client->name, channel->chname); continue; } @@ -535,21 +535,21 @@ getnick: modeflags = 0; } - if (!IsMember(acptr, chptr)) + if (!IsMember(acptr, channel)) { /* User joining the channel, send JOIN to local users. */ MessageTag *mtags = NULL; - add_user_to_channel(chptr, acptr, modeflags); - RunHook4(HOOKTYPE_REMOTE_JOIN, acptr, chptr, recv_mtags, NULL); - new_message_special(acptr, recv_mtags, &mtags, ":%s JOIN %s", acptr->name, chptr->chname); - send_join_to_local_users(acptr, chptr, mtags); + add_user_to_channel(channel, acptr, modeflags); + RunHook4(HOOKTYPE_REMOTE_JOIN, acptr, channel, recv_mtags, NULL); + new_message_special(acptr, recv_mtags, &mtags, ":%s JOIN %s", acptr->name, channel->chname); + send_join_to_local_users(acptr, channel, mtags); free_message_tags(mtags); } /* old servers without SJOIN: */ - sendto_server(client, 0, PROTO_SJOIN, NULL, ":%s JOIN %s", acptr->name, chptr->chname); + sendto_server(client, 0, PROTO_SJOIN, NULL, ":%s JOIN %s", acptr->name, channel->chname); CheckStatus('q', CHFL_CHANOWNER); CheckStatus('a', CHFL_CHANADMIN); @@ -567,7 +567,7 @@ getnick: { ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'", nick_buf, prefix, acptr->name); - sendto_realops("Oversized SJOIN for %s -- see ircd log", chptr->chname); + sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname); continue; } } @@ -583,7 +583,7 @@ getnick: { ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'", uid_buf, prefix, ID(acptr)); - sendto_realops("Oversized SJOIN for %s -- see ircd log", chptr->chname); + sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname); continue; } } @@ -599,7 +599,7 @@ getnick: { ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'", uid_sjsby_buf, prefix, ID(acptr)); - sendto_realops("Oversized SJOIN for %s -- see ircd log", chptr->chname); + sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname); continue; } } @@ -628,21 +628,21 @@ getnick: /* Adding of list modes */ if (modeflags & CHFL_BAN) { - if (add_listmode_ex(&chptr->banlist, client, chptr, nick, setby, setat) != -1) + if (add_listmode_ex(&channel->banlist, client, channel, nick, setby, setat) != -1) { Addit('b', nick); } } if (modeflags & CHFL_EXCEPT) { - if (add_listmode_ex(&chptr->exlist, client, chptr, nick, setby, setat) != -1) + if (add_listmode_ex(&channel->exlist, client, channel, nick, setby, setat) != -1) { Addit('e', nick); } } if (modeflags & CHFL_INVEX) { - if (add_listmode_ex(&chptr->invexlist, client, chptr, nick, setby, setat) != -1) + if (add_listmode_ex(&channel->invexlist, client, channel, nick, setby, setat) != -1) { Addit('I', nick); } @@ -658,7 +658,7 @@ getnick: { ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'", nick_buf, prefix, nick); - sendto_realops("Oversized SJOIN for %s -- see ircd log", chptr->chname); + sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname); continue; } } @@ -674,7 +674,7 @@ getnick: { ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'", uid_buf, prefix, nick); - sendto_realops("Oversized SJOIN for %s -- see ircd log", chptr->chname); + sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname); continue; } } @@ -695,7 +695,7 @@ getnick: if (strlen(uid_sjsby_buf) + strlen(scratch_buf) > BUFSIZE - 5) { ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s'", uid_sjsby_buf, scratch_buf); - sendto_realops("Oversized SJOIN for %s -- see ircd log", chptr->chname); + sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname); continue; } } @@ -719,12 +719,12 @@ getnick: /* for old servers without sjoin: */ sendto_server(client, 0, PROTO_SJOIN, mtags, ":%s MODE %s %s %s %lld", - client->name, chptr->chname, modebuf, parabuf, - (long long)chptr->creationtime); - new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, chptr->chname, modebuf, parabuf); - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + client->name, channel->chname, modebuf, parabuf, + (long long)channel->creationtime); + new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf); + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", - client->name, chptr->chname, modebuf, parabuf); + client->name, channel->chname, modebuf, parabuf); free_message_tags(mtags); } @@ -746,17 +746,17 @@ getnick: strlcpy(paraback, parabuf, sizeof paraback); ap = mp2parv(modebuf, parabuf); - set_mode(chptr, client, ap->parc, ap->parv, &pcount, pvar, 0); + set_mode(channel, client, ap->parc, ap->parv, &pcount, pvar, 0); /* for old servers without SJOIN: */ sendto_server(client, 0, PROTO_SJOIN, NULL, ":%s MODE %s %s %s %lld", - client->name, chptr->chname, modebuf, paraback, - (long long)chptr->creationtime); - new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, chptr->chname, modebuf, parabuf); - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + client->name, channel->chname, modebuf, paraback, + (long long)channel->creationtime); + new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf); + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", - client->name, chptr->chname, modebuf, parabuf); + client->name, channel->chname, modebuf, parabuf); free_message_tags(mtags); } @@ -766,9 +766,9 @@ getnick: Mode oldmode; /**< The old mode (OUR mode) */ /* Copy current mode to oldmode (need to duplicate all extended mode params too..) */ - memcpy(&oldmode, &chptr->mode, sizeof(oldmode)); + memcpy(&oldmode, &channel->mode, sizeof(oldmode)); memset(&oldmode.extmodeparams, 0, sizeof(oldmode.extmodeparams)); - extcmode_duplicate_paramlist(chptr->mode.extmodeparams, oldmode.extmodeparams); + extcmode_duplicate_paramlist(channel->mode.extmodeparams, oldmode.extmodeparams); /* Now merge the modes */ strlcpy(modebuf, parv[3], sizeof modebuf); @@ -782,7 +782,7 @@ getnick: } } ap = mp2parv(modebuf, parabuf); - set_mode(chptr, client, ap->parc, ap->parv, &pcount, pvar, 0); + set_mode(channel, client, ap->parc, ap->parv, &pcount, pvar, 0); /* Good, now we got modes, now for the differencing and outputting of modes * We first see if any para modes are set. @@ -791,23 +791,23 @@ getnick: parabuf[0] = '\0'; b = 1; /* however, is this really going to happen at all? may be unneeded */ - if (oldmode.limit && !chptr->mode.limit) + if (oldmode.limit && !channel->mode.limit) { Addsingle('l'); } - if (oldmode.key[0] && !chptr->mode.key[0]) + if (oldmode.key[0] && !channel->mode.key[0]) { Addit('k', oldmode.key); } /* First, check if we have something they don't have.. - * note that: oldmode.* = us, chptr->mode.* = them. + * note that: oldmode.* = us, channel->mode.* = them. */ for (i=0; i <= Channelmode_highest; i++) { if ((Channelmode_Table[i].flag) && (oldmode.extmode & Channelmode_Table[i].mode) && - !(chptr->mode.extmode & Channelmode_Table[i].mode)) + !(channel->mode.extmode & Channelmode_Table[i].mode)) { if (Channelmode_Table[i].paracount) { @@ -821,18 +821,18 @@ getnick: } /* Check if we had +s and it became +p, then revert it... */ - if ((oldmode.mode & MODE_SECRET) && (chptr->mode.mode & MODE_PRIVATE)) + if ((oldmode.mode & MODE_SECRET) && (channel->mode.mode & MODE_PRIVATE)) { /* stay +s ! */ - chptr->mode.mode &= ~MODE_PRIVATE; - chptr->mode.mode |= MODE_SECRET; + channel->mode.mode &= ~MODE_PRIVATE; + channel->mode.mode |= MODE_SECRET; Addsingle('p'); /* - */ queue_s = 1; } /* Add single char modes... */ for (acp = corechannelmodetable; acp->mode; acp++) { - if ((oldmode.mode & acp->mode) && !(chptr->mode.mode & acp->mode) && !acp->parameters) + if ((oldmode.mode & acp->mode) && !(channel->mode.mode & acp->mode) && !acp->parameters) { Addsingle(acp->flag); } @@ -855,24 +855,24 @@ getnick: for (acp = corechannelmodetable; acp->mode; acp++) { - if (!(oldmode.mode & acp->mode) && (chptr->mode.mode & acp->mode) && !acp->parameters) + if (!(oldmode.mode & acp->mode) && (channel->mode.mode & acp->mode) && !acp->parameters) { Addsingle(acp->flag); } } /* Now, check if they have something we don't have.. - * note that: oldmode.* = us, chptr->mode.* = them. + * note that: oldmode.* = us, channel->mode.* = them. */ for (i=0; i <= Channelmode_highest; i++) { if ((Channelmode_Table[i].flag) && !(oldmode.extmode & Channelmode_Table[i].mode) && - (chptr->mode.extmode & Channelmode_Table[i].mode)) + (channel->mode.extmode & Channelmode_Table[i].mode)) { if (Channelmode_Table[i].paracount) { - char *parax = cm_getparameter(chptr, Channelmode_Table[i].flag); + char *parax = cm_getparameter(channel, Channelmode_Table[i].flag); if (parax) { Addit(Channelmode_Table[i].flag, parax); @@ -886,56 +886,56 @@ getnick: /* now, if we had diffent para modes - this loop really could be done better, but */ /* +l (limit) difference? */ - if (oldmode.limit && chptr->mode.limit && (oldmode.limit != chptr->mode.limit)) + if (oldmode.limit && channel->mode.limit && (oldmode.limit != channel->mode.limit)) { - chptr->mode.limit = MAX(oldmode.limit, chptr->mode.limit); - if (oldmode.limit != chptr->mode.limit) + channel->mode.limit = MAX(oldmode.limit, channel->mode.limit); + if (oldmode.limit != channel->mode.limit) { - Addit('l', my_itoa(chptr->mode.limit)); + Addit('l', my_itoa(channel->mode.limit)); } } /* +k (key) difference? */ - if (oldmode.key[0] && chptr->mode.key[0] && strcmp(oldmode.key, chptr->mode.key)) + if (oldmode.key[0] && channel->mode.key[0] && strcmp(oldmode.key, channel->mode.key)) { - if (strcmp(oldmode.key, chptr->mode.key) > 0) + if (strcmp(oldmode.key, channel->mode.key) > 0) { - strlcpy(chptr->mode.key, oldmode.key, sizeof chptr->mode.key); + strlcpy(channel->mode.key, oldmode.key, sizeof channel->mode.key); } else { - Addit('k', chptr->mode.key); + Addit('k', channel->mode.key); } } /* Now, check for any param differences in extended channel modes.. - * note that: oldmode.* = us, chptr->mode.* = them. - * if we win: copy oldmode to chptr mode, if they win: send the mode + * note that: oldmode.* = us, channel->mode.* = them. + * if we win: copy oldmode to channel mode, if they win: send the mode */ for (i=0; i <= Channelmode_highest; i++) { if (Channelmode_Table[i].flag && Channelmode_Table[i].paracount && (oldmode.extmode & Channelmode_Table[i].mode) && - (chptr->mode.extmode & Channelmode_Table[i].mode)) + (channel->mode.extmode & Channelmode_Table[i].mode)) { int r; char *parax; char flag = Channelmode_Table[i].flag; void *ourm = GETPARASTRUCTEX(oldmode.extmodeparams, flag); - void *theirm = GETPARASTRUCT(chptr, flag); + void *theirm = GETPARASTRUCT(channel, flag); //CmodeParam *ourm = extcmode_get_struct(oldmode.extmodeparam,Channelmode_Table[i].flag); - //CmodeParam *theirm = extcmode_get_struct(chptr->mode.extmodeparam, Channelmode_Table[i].flag); + //CmodeParam *theirm = extcmode_get_struct(channel->mode.extmodeparam, Channelmode_Table[i].flag); - r = Channelmode_Table[i].sjoin_check(chptr, ourm, theirm); + r = Channelmode_Table[i].sjoin_check(channel, ourm, theirm); switch (r) { case EXSJ_WEWON: parax = cm_getparameter_ex(oldmode.extmodeparams, flag); /* grab from old */ - cm_putparameter(chptr, flag, parax); /* put in new (won) */ + cm_putparameter(channel, flag, parax); /* put in new (won) */ break; case EXSJ_THEYWON: - parax = cm_getparameter(chptr, flag); + parax = cm_getparameter(channel, flag); Debug((DEBUG_DEBUG, "sjoin: they won: '%s'", parax)); Addit(Channelmode_Table[i].flag, parax); break; @@ -946,7 +946,7 @@ getnick: case EXSJ_MERGE: parax = cm_getparameter_ex(oldmode.extmodeparams, flag); /* grab from old */ - cm_putparameter(chptr, flag, parax); /* put in new (won) */ + cm_putparameter(channel, flag, parax); /* put in new (won) */ Addit(flag, parax); break; @@ -966,12 +966,12 @@ getnick: /* for old servers without SJOIN: */ sendto_server(client, 0, PROTO_SJOIN, NULL, ":%s MODE %s %s %s %lld", - client->name, chptr->chname, modebuf, parabuf, - (long long)chptr->creationtime); - new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, chptr->chname, modebuf, parabuf); - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + client->name, channel->chname, modebuf, parabuf, + (long long)channel->creationtime); + new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf); + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", - client->name, chptr->chname, modebuf, parabuf); + client->name, channel->chname, modebuf, parabuf); free_message_tags(mtags); } @@ -982,20 +982,20 @@ getnick: for (h = Hooks[HOOKTYPE_CHANNEL_SYNCED]; h; h = h->next) { - int i = (*(h->func.intfunc))(chptr,merge,removetheirs,nomode); + int i = (*(h->func.intfunc))(channel,merge,removetheirs,nomode); if (i == 1) return; /* channel no longer exists */ } /* we should be synched by now, */ - if ((oldts != -1) && (oldts != chptr->creationtime)) + if ((oldts != -1) && (oldts != channel->creationtime)) { MessageTag *mtags = NULL; new_message(client, NULL, &mtags); - sendto_channel(chptr, &me, NULL, 0, 0, SEND_LOCAL, NULL, + sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, NULL, ":%s NOTICE %s :*** TS for %s changed from %lld to %lld", - me.name, chptr->chname, chptr->chname, - (long long)oldts, (long long)chptr->creationtime); + me.name, channel->chname, channel->chname, + (long long)oldts, (long long)channel->creationtime); free_message_tags(mtags); } @@ -1003,9 +1003,9 @@ getnick: * the channel actually has no users in it at this point, * then destroy the channel. */ - if (!chptr->users) + if (!channel->users) { - sub1_from_channel(chptr); + sub1_from_channel(channel); return; } } diff --git a/src/modules/stats.c b/src/modules/stats.c index 67411ec8f..85e91308d 100644 --- a/src/modules/stats.c +++ b/src/modules/stats.c @@ -713,7 +713,7 @@ int stats_mem(Client *client, char *para) Client *acptr; Ban *ban; Link *link; - Channel *chptr; + Channel *channel; int lc = 0, /* local clients */ ch = 0, /* channels */ @@ -788,29 +788,29 @@ int stats_mem(Client *client, char *para) lcm = lc * sizeof(Client)+sizeof(LocalClient); rcm = rc * sizeof(Client); - for (chptr = channels; chptr; chptr = chptr->nextch) + for (channel = channels; channel; channel = channel->nextch) { Member *member; ch++; - chm += (strlen(chptr->chname) + sizeof(Channel)); - for (member = chptr->members; member; member = member->next) + chm += (strlen(channel->chname) + sizeof(Channel)); + for (member = channel->members; member; member = member->next) chu++; - for (link = chptr->invites; link; link = link->next) + for (link = channel->invites; link; link = link->next) chi++; - for (ban = chptr->banlist; ban; ban = ban->next) + for (ban = channel->banlist; ban; ban = ban->next) { chb++; chbm += (strlen(ban->banstr) + 1 + strlen(ban->who) + 1 + sizeof(Ban)); } - for (ban = chptr->exlist; ban; ban = ban->next) + for (ban = channel->exlist; ban; ban = ban->next) { chb++; chbm += (strlen(ban->banstr) + 1 + strlen(ban->who) + 1 + sizeof(Ban)); } - for (ban = chptr->invexlist; ban; ban = ban->next) + for (ban = channel->invexlist; ban; ban = ban->next) { chb++; chbm += (strlen(ban->banstr) + 1 + diff --git a/src/modules/svsmode.c b/src/modules/svsmode.c index 79e79c239..1253b8c35 100644 --- a/src/modules/svsmode.c +++ b/src/modules/svsmode.c @@ -26,7 +26,7 @@ #include "unrealircd.h" -void add_send_mode_param(Channel *chptr, Client *from, char what, char mode, char *param); +void add_send_mode_param(Channel *channel, Client *from, char what, char mode, char *param); CMD_FUNC(cmd_svsmode); CMD_FUNC(cmd_svs2mode); @@ -60,7 +60,7 @@ MOD_UNLOAD() return MOD_SUCCESS; } -void unban_user(Client *client, Channel *chptr, Client *acptr, char chmode) +void unban_user(Client *client, Channel *channel, Client *acptr, char chmode) { Extban *extban; Ban *ban, *bnext; @@ -100,13 +100,13 @@ void unban_user(Client *client, Channel *chptr, Client *acptr, char chmode) switch (chmode) { case 'b': - banlist = &chptr->banlist; + banlist = &channel->banlist; break; case 'e': - banlist = &chptr->exlist; + banlist = &channel->exlist; break; case 'I': - banlist = &chptr->invexlist; + banlist = &channel->invexlist; break; default: abort(); @@ -122,25 +122,25 @@ void unban_user(Client *client, Channel *chptr, Client *acptr, char chmode) (*ihost && match_simple(ban->banstr, ihost)) || (*chost && match_simple(ban->banstr, chost))) { - add_send_mode_param(chptr, client, '-', chmode, + add_send_mode_param(channel, client, '-', chmode, ban->banstr); - del_listmode(banlist, chptr, ban->banstr); + del_listmode(banlist, channel, ban->banstr); } else if (chmode != 'I' && *ban->banstr == '~' && (extban = findmod_by_bantype(ban->banstr[1]))) { if (extban->options & EXTBOPT_CHSVSMODE) { - if (extban->is_banned(acptr, chptr, ban->banstr, BANCHK_JOIN, NULL, NULL)) + if (extban->is_banned(acptr, channel, ban->banstr, BANCHK_JOIN, NULL, NULL)) { - add_send_mode_param(chptr, acptr, '-', chmode, ban->banstr); - del_listmode(banlist, chptr, ban->banstr); + add_send_mode_param(channel, acptr, '-', chmode, ban->banstr); + del_listmode(banlist, channel, ban->banstr); } } } } } -void clear_bans(Client *client, Channel *chptr, char chmode) +void clear_bans(Client *client, Channel *channel, char chmode) { Extban *extban; Ban *ban, *bnext; @@ -149,13 +149,13 @@ void clear_bans(Client *client, Channel *chptr, char chmode) switch (chmode) { case 'b': - banlist = &chptr->banlist; + banlist = &channel->banlist; break; case 'e': - banlist = &chptr->exlist; + banlist = &channel->exlist; break; case 'I': - banlist = &chptr->invexlist; + banlist = &channel->invexlist; break; default: abort(); @@ -169,8 +169,8 @@ void clear_bans(Client *client, Channel *chptr, char chmode) if (!(extban->options & EXTBOPT_CHSVSMODE)) continue; } - add_send_mode_param(chptr, client, '-', chmode, ban->banstr); - del_listmode(banlist, chptr, ban->banstr); + add_send_mode_param(channel, client, '-', chmode, ban->banstr); + del_listmode(banlist, channel, ban->banstr); } } @@ -197,7 +197,7 @@ void clear_bans(Client *client, Channel *chptr, char chmode) */ void channel_svsmode(Client *client, int parc, char *parv[]) { - Channel *chptr; + Channel *channel; Client *target; char *m; int what = MODE_ADD; @@ -210,7 +210,7 @@ void channel_svsmode(Client *client, int parc, char *parv[]) if ((parc < 3) || BadPtr(parv[2])) return; - if (!(chptr = find_channel(parv[1], NULL))) + if (!(channel = find_channel(parv[1], NULL))) return; for(m = parv[2]; *m; m++) @@ -231,17 +231,17 @@ void channel_svsmode(Client *client, int parc, char *parv[]) if (what != MODE_DEL) { sendto_realops("Warning! Received SVS(2)MODE with +%c for %s from %s, which is invalid!!", - *m, chptr->chname, client->name); + *m, channel->chname, client->name); continue; } channel_flags = char_to_channelflag(*m); - for (cm = chptr->members; cm; cm = cm->next) + for (cm = channel->members; cm; cm = cm->next) { if (cm->flags & channel_flags) { Membership *mb; - mb = find_membership_link(cm->client->user->channel, chptr); - add_send_mode_param(chptr, client, '-', *m, cm->client->name); + mb = find_membership_link(cm->client->user->channel, channel); + add_send_mode_param(channel, client, '-', *m, cm->client->name); cm->flags &= ~channel_flags; if (mb) mb->flags = cm->flags; @@ -260,15 +260,15 @@ void channel_svsmode(Client *client, int parc, char *parv[]) } i++; - unban_user(client, chptr, target, *m); + unban_user(client, channel, target, *m); } else { - clear_bans(client, chptr, *m); + clear_bans(client, channel, *m); } break; default: sendto_realops("Warning! Invalid mode `%c' used with 'SVSMODE %s %s %s' (from %s %s)", - *m, chptr->chname, parv[2], parv[3] ? parv[3] : "", + *m, channel->chname, parv[2], parv[3] ? parv[3] : "", client->direction->name, client->name); break; } @@ -281,13 +281,13 @@ void channel_svsmode(Client *client, int parc, char *parv[]) /* NOTE: cannot use 'recv_mtag' here because MODE could be rewrapped. Not ideal :( */ new_message(client, NULL, &mtags); - sendto_channel(chptr, client, client, 0, 0, SEND_LOCAL, mtags, + sendto_channel(channel, client, client, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", - client->name, chptr->chname, modebuf, parabuf); - sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", client->name, chptr->chname, modebuf, parabuf); + client->name, channel->chname, modebuf, parabuf); + sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf); /* Activate this hook just like cmd_mode.c */ - RunHook7(HOOKTYPE_REMOTE_CHANMODE, client, chptr, mtags, modebuf, parabuf, 0, 0); + RunHook7(HOOKTYPE_REMOTE_CHANMODE, client, channel, mtags, modebuf, parabuf, 0, 0); free_message_tags(mtags); @@ -545,7 +545,7 @@ CMD_FUNC(cmd_svs2mode) return do_svsmode(client, recv_mtags, parc, parv, 1); } -void add_send_mode_param(Channel *chptr, Client *from, char what, char mode, char *param) +void add_send_mode_param(Channel *channel, Client *from, char what, char mode, char *param) { static char *modes = NULL, lastwhat; static short count = 0; @@ -588,10 +588,10 @@ void add_send_mode_param(Channel *chptr, Client *from, char what, char mode, cha MessageTag *mtags = NULL; /* NOTE: cannot use 'recv_mtag' here because MODE could be rewrapped. Not ideal :( */ new_message(from, NULL, &mtags); - sendto_channel(chptr, from, from, 0, 0, SEND_LOCAL, mtags, + sendto_channel(channel, from, from, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", - from->name, chptr->chname, modebuf, parabuf); - sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", from->name, chptr->chname, modebuf, parabuf); + from->name, channel->chname, modebuf, parabuf); + sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", from->name, channel->chname, modebuf, parabuf); free_message_tags(mtags); send = 0; *parabuf = 0; diff --git a/src/modules/tkl.c b/src/modules/tkl.c index 3dc395fe9..3c29589b7 100644 --- a/src/modules/tkl.c +++ b/src/modules/tkl.c @@ -4212,7 +4212,7 @@ static int target_is_spamexcept(char *target) int _join_viruschan(Client *client, TKL *tkl, int type) { char *xparv[3], chbuf[CHANNELLEN + 16], buf[2048]; - Channel *chptr; + Channel *channel; int ret; snprintf(buf, sizeof(buf), "0,%s", SPAMFILTER_VIRUSCHAN); @@ -4231,16 +4231,16 @@ int _join_viruschan(Client *client, TKL *tkl, int type) sendnotice(client, "You are now restricted to talking in %s: %s", SPAMFILTER_VIRUSCHAN, unreal_decodespace(tkl->ptr.spamfilter->tkl_reason)); - chptr = find_channel(SPAMFILTER_VIRUSCHAN, NULL); - if (chptr) + channel = find_channel(SPAMFILTER_VIRUSCHAN, NULL); + if (channel) { MessageTag *mtags = NULL; - ircsnprintf(chbuf, sizeof(chbuf), "@%s", chptr->chname); + ircsnprintf(chbuf, sizeof(chbuf), "@%s", channel->chname); ircsnprintf(buf, sizeof(buf), "[Spamfilter] %s matched filter '%s' [%s] [%s]", client->name, tkl->ptr.spamfilter->match->str, cmdname_by_spamftarget(type), unreal_decodespace(tkl->ptr.spamfilter->tkl_reason)); new_message(&me, NULL, &mtags); - sendto_channel(chptr, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, + sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, 0, SEND_ALL|SKIP_DEAF, mtags, ":%s NOTICE %s :%s", me.name, chbuf, buf); free_message_tags(mtags); diff --git a/src/modules/topic.c b/src/modules/topic.c index d8d4e04c8..377390b28 100644 --- a/src/modules/topic.c +++ b/src/modules/topic.c @@ -52,17 +52,17 @@ MOD_UNLOAD() return MOD_SUCCESS; } -void topicoverride(Client *client, Channel *chptr, char *topic) +void topicoverride(Client *client, Channel *channel, char *topic) { sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) TOPIC %s \'%s\'", client->name, client->user->username, client->user->realhost, - chptr->chname, topic); + channel->chname, topic); /* Logging implementation added by XeRXeS */ ircd_log(LOG_OVERRIDE, "OVERRIDE: %s (%s@%s) TOPIC %s \'%s\'", client->name, client->user->username, client->user->realhost, - chptr->chname, topic); + channel->chname, topic); } /** Query or change the channel topic. @@ -79,7 +79,7 @@ void topicoverride(Client *client, Channel *chptr, char *topic) */ CMD_FUNC(cmd_topic) { - Channel *chptr = NULL; + Channel *channel = NULL; char *topic = NULL, *name, *tnick = client->name; char *errmsg = NULL; time_t ttime = 0; @@ -97,21 +97,21 @@ CMD_FUNC(cmd_topic) name = parv[1]; - chptr = find_channel(parv[1], NULL); - if (!chptr) + channel = find_channel(parv[1], NULL); + if (!channel) { sendnumeric(client, ERR_NOSUCHCHANNEL, name); return; } - ismember = IsMember(client, chptr); /* CACHE */ + ismember = IsMember(client, channel); /* CACHE */ if (ismember) - flags = get_access(client, chptr); /* CACHE */ + flags = get_access(client, channel); /* CACHE */ - if (parc > 2 || SecretChannel(chptr)) + if (parc > 2 || SecretChannel(channel)) { if (!ismember && !IsServer(client) - && !ValidatePermissionsForPath("channel:see:list:secret",client,NULL,chptr,NULL) && !IsULine(client)) + && !ValidatePermissionsForPath("channel:see:list:secret",client,NULL,channel,NULL) && !IsULine(client)) { sendnumeric(client, ERR_NOTONCHANNEL, name); return; @@ -134,55 +134,55 @@ CMD_FUNC(cmd_topic) for (h = Hooks[HOOKTYPE_VIEW_TOPIC_OUTSIDE_CHANNEL]; h; h = h->next) { - i = (*(h->func.intfunc))(client,chptr); + i = (*(h->func.intfunc))(client,channel); if (i != HOOK_CONTINUE) break; } /* If you're not a member, and you can't view outside channel, deny */ if ((!ismember && i == HOOK_DENY) || - (is_banned(client,chptr,BANCHK_JOIN,NULL,NULL) && - !ValidatePermissionsForPath("channel:see:topic",client,NULL,chptr,NULL))) + (is_banned(client,channel,BANCHK_JOIN,NULL,NULL) && + !ValidatePermissionsForPath("channel:see:topic",client,NULL,channel,NULL))) { sendnumeric(client, ERR_NOTONCHANNEL, name); return; } - if (!chptr->topic) - sendnumeric(client, RPL_NOTOPIC, chptr->chname); + if (!channel->topic) + sendnumeric(client, RPL_NOTOPIC, channel->chname); else { sendnumeric(client, RPL_TOPIC, - chptr->chname, chptr->topic); - sendnumeric(client, RPL_TOPICWHOTIME, chptr->chname, - chptr->topic_nick, chptr->topic_time); + channel->chname, channel->topic); + sendnumeric(client, RPL_TOPICWHOTIME, channel->chname, + channel->topic_nick, channel->topic_time); } return; } if (ttime && topic && (IsServer(client) || IsULine(client))) { - if (!chptr->topic_time || ttime > chptr->topic_time || IsULine(client)) + if (!channel->topic_time || ttime > channel->topic_time || IsULine(client)) /* The IsUline is to allow services to use an old TS. Apparently * some services do this in their topic enforcement -- codemastr */ { /* Set the topic */ - safe_strldup(chptr->topic, topic, iConf.topic_length+1); - safe_strldup(chptr->topic_nick, tnick, NICKLEN+USERLEN+HOSTLEN+5); - chptr->topic_time = ttime; + safe_strldup(channel->topic, topic, iConf.topic_length+1); + safe_strldup(channel->topic_nick, tnick, NICKLEN+USERLEN+HOSTLEN+5); + channel->topic_time = ttime; new_message(client, recv_mtags, &mtags); - RunHook4(HOOKTYPE_TOPIC, client, chptr, mtags, topic); + RunHook4(HOOKTYPE_TOPIC, client, channel, mtags, topic); sendto_server(client, PROTO_SID, 0, mtags, ":%s TOPIC %s %s %lld :%s", - ID(client), chptr->chname, chptr->topic_nick, - (long long)chptr->topic_time, chptr->topic); + ID(client), channel->chname, channel->topic_nick, + (long long)channel->topic_time, channel->topic); sendto_server(client, 0, PROTO_SID, mtags, ":%s TOPIC %s %s %lld :%s", - client->name, chptr->chname, chptr->topic_nick, - (long long)chptr->topic_time, chptr->topic); - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + client->name, channel->chname, channel->topic_nick, + (long long)channel->topic_time, channel->topic); + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s TOPIC %s :%s", - client->name, chptr->chname, chptr->topic); + client->name, channel->chname, channel->topic); free_message_tags(mtags); } return; @@ -194,46 +194,46 @@ CMD_FUNC(cmd_topic) char *newtopic = NULL; /* +t and not +hoaq ? */ - if ((chptr->mode.mode & MODE_TOPICLIMIT) && - !is_skochanop(client, chptr) && !IsULine(client) && !IsServer(client)) + if ((channel->mode.mode & MODE_TOPICLIMIT) && + !is_skochanop(client, channel) && !IsULine(client) && !IsServer(client)) { - if (MyUser(client) && !ValidatePermissionsForPath("channel:override:topic", client, NULL, chptr, NULL)) + if (MyUser(client) && !ValidatePermissionsForPath("channel:override:topic", client, NULL, channel, NULL)) { - sendnumeric(client, ERR_CHANOPRIVSNEEDED, chptr->chname); + sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname); return; } - topicoverride(client, chptr, topic); + topicoverride(client, channel, topic); } /* -t and banned? */ newtopic = topic; - if (!(chptr->mode.mode & MODE_TOPICLIMIT) && - !is_skochanop(client, chptr) && is_banned(client, chptr, BANCHK_MSG, &newtopic, &errmsg)) + if (!(channel->mode.mode & MODE_TOPICLIMIT) && + !is_skochanop(client, channel) && is_banned(client, channel, BANCHK_MSG, &newtopic, &errmsg)) { char buf[512]; - if (MyUser(client) && !ValidatePermissionsForPath("channel:override:topic", client, NULL, chptr, NULL)) + if (MyUser(client) && !ValidatePermissionsForPath("channel:override:topic", client, NULL, channel, NULL)) { - ircsnprintf(buf, sizeof(buf), "You cannot change the topic on %s while being banned", chptr->chname); + ircsnprintf(buf, sizeof(buf), "You cannot change the topic on %s while being banned", channel->chname); sendnumeric(client, ERR_CANNOTDOCOMMAND, "TOPIC", buf); return; } - topicoverride(client, chptr, topic); + topicoverride(client, channel, topic); } if (MyUser(client) && newtopic) topic = newtopic; /* process is_banned() changes of topic (eg: text replacement), but only for local clients */ /* -t, +m, and not +vhoaq */ - if (((flags&CHFL_OVERLAP) == 0) && (chptr->mode.mode & MODE_MODERATED)) + if (((flags&CHFL_OVERLAP) == 0) && (channel->mode.mode & MODE_MODERATED)) { char buf[512]; - if (MyUser(client) && ValidatePermissionsForPath("channel:override:topic", client, NULL, chptr, NULL)) + if (MyUser(client) && ValidatePermissionsForPath("channel:override:topic", client, NULL, channel, NULL)) { - topicoverride(client, chptr, topic); + topicoverride(client, channel, topic); } else { /* With +m and -t, only voice and higher may change the topic */ - ircsnprintf(buf, sizeof(buf), "Voice (+v) or higher is required in order to change the topic on %s (channel is +m)", chptr->chname); + ircsnprintf(buf, sizeof(buf), "Voice (+v) or higher is required in order to change the topic on %s (channel is +m)", channel->chname); sendnumeric(client, ERR_CANNOTDOCOMMAND, "TOPIC", buf); return; } @@ -245,11 +245,11 @@ CMD_FUNC(cmd_topic) Hook *tmphook; int n; - if (match_spamfilter(client, topic, SPAMF_TOPIC, chptr->chname, 0, NULL)) + if (match_spamfilter(client, topic, SPAMF_TOPIC, channel->chname, 0, NULL)) return; for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_TOPIC]; tmphook; tmphook = tmphook->next) { - topic = (*(tmphook->func.pcharfunc))(client, chptr, topic); + topic = (*(tmphook->func.pcharfunc))(client, channel, topic); if (!topic) return; } @@ -264,21 +264,21 @@ CMD_FUNC(cmd_topic) } /* Set the topic */ - safe_strldup(chptr->topic, topic, iConf.topic_length+1); - safe_strldup(chptr->topic_nick, tnick, NICKLEN+USERLEN+HOSTLEN+5); + safe_strldup(channel->topic, topic, iConf.topic_length+1); + safe_strldup(channel->topic_nick, tnick, NICKLEN+USERLEN+HOSTLEN+5); if (ttime && !MyUser(client)) - chptr->topic_time = ttime; + channel->topic_time = ttime; else - chptr->topic_time = TStime(); + channel->topic_time = TStime(); new_message(client, recv_mtags, &mtags); - RunHook4(HOOKTYPE_TOPIC, client, chptr, mtags, topic); + RunHook4(HOOKTYPE_TOPIC, client, channel, mtags, topic); sendto_server(client, 0, 0, mtags, ":%s TOPIC %s %s %lld :%s", - client->name, chptr->chname, chptr->topic_nick, - (long long)chptr->topic_time, chptr->topic); - sendto_channel(chptr, client, NULL, 0, 0, SEND_LOCAL, mtags, + client->name, channel->chname, channel->topic_nick, + (long long)channel->topic_time, channel->topic); + sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s TOPIC %s :%s", - client->name, chptr->chname, chptr->topic); + client->name, channel->chname, channel->topic); free_message_tags(mtags); } diff --git a/src/modules/usermodes/bot.c b/src/modules/usermodes/bot.c index 65c76bd0e..eb69744c6 100644 --- a/src/modules/usermodes/bot.c +++ b/src/modules/usermodes/bot.c @@ -36,7 +36,7 @@ long UMODE_BOT = 0L; /* Forward declarations */ int bot_whois(Client *client, Client *acptr); -int bot_who_status(Client *client, Client *acptr, Channel *chptr, Member *cm, char *status, int cansee); +int bot_who_status(Client *client, Client *acptr, Channel *channel, Member *cm, char *status, int cansee); int bot_umode_change(Client *client, long oldmode, long newmode); MOD_TEST() @@ -74,7 +74,7 @@ int bot_whois(Client *requester, Client *acptr) return 0; } -int bot_who_status(Client *requester, Client *acptr, Channel *chptr, Member *cm, char *status, int cansee) +int bot_who_status(Client *requester, Client *acptr, Channel *channel, Member *cm, char *status, int cansee) { if (IsBot(acptr)) return 'B'; diff --git a/src/modules/usermodes/nokick.c b/src/modules/usermodes/nokick.c index 8a4402a70..768bca03f 100644 --- a/src/modules/usermodes/nokick.c +++ b/src/modules/usermodes/nokick.c @@ -35,7 +35,7 @@ ModuleHeader MOD_HEADER long UMODE_NOKICK = 0L; /* Forward declarations */ -int nokick_can_kick(Client *client, Client *target, Channel *chptr, +int nokick_can_kick(Client *client, Client *target, Channel *channel, char *comment, long client_flags, long target_flags, char **reject_reason); MOD_TEST() @@ -63,12 +63,12 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int nokick_can_kick(Client *client, Client *target, Channel *chptr, char *comment, +int nokick_can_kick(Client *client, Client *target, Channel *channel, char *comment, long client_flags, long target_flags, char **reject_reason) { static char errmsg[NICKLEN+256]; - if (IsNokick(target) && !IsULine(client) && MyUser(client) && !ValidatePermissionsForPath("channel:override:kick:nokick",client,target,chptr,NULL)) + if (IsNokick(target) && !IsULine(client) && MyUser(client) && !ValidatePermissionsForPath("channel:override:kick:nokick",client,target,channel,NULL)) { ircsnprintf(errmsg, sizeof(errmsg), ":%s %d %s %s :%s", me.name, ERR_CANNOTDOCOMMAND, client->name, "KICK", @@ -78,7 +78,7 @@ int nokick_can_kick(Client *client, Client *target, Channel *chptr, char *commen sendnotice(target, "*** umode q: %s tried to kick you from channel %s (%s)", - client->name, chptr->chname, comment); + client->name, channel->chname, comment); return EX_ALWAYS_DENY; } diff --git a/src/modules/usermodes/privacy.c b/src/modules/usermodes/privacy.c index 2ab5af797..5a0fcce38 100644 --- a/src/modules/usermodes/privacy.c +++ b/src/modules/usermodes/privacy.c @@ -35,7 +35,7 @@ ModuleHeader MOD_HEADER long UMODE_PRIVACY = 0L; /* Forward declarations */ -int privacy_see_channel_in_whois(Client *client, Client *target, Channel *chptr); +int privacy_see_channel_in_whois(Client *client, Client *target, Channel *channel); MOD_INIT() { @@ -60,9 +60,9 @@ MOD_UNLOAD() /* This hides channels in /WHOIS output, unless the requestor is in the same channel * or some IRCOp is overriding. */ -int privacy_see_channel_in_whois(Client *client, Client *target, Channel *chptr) +int privacy_see_channel_in_whois(Client *client, Client *target, Channel *channel) { - if (IsPrivacy(target) && !IsMember(client, chptr)) + if (IsPrivacy(target) && !IsMember(client, channel)) return EX_DENY; return EX_ALLOW; diff --git a/src/modules/usermodes/servicebot.c b/src/modules/usermodes/servicebot.c index 4dae937b8..66fd9767c 100644 --- a/src/modules/usermodes/servicebot.c +++ b/src/modules/usermodes/servicebot.c @@ -37,13 +37,13 @@ ModuleHeader MOD_HEADER long UMODE_SERVICEBOT = 0L; /* Forward declarations */ -int servicebot_can_kick(Client *client, Client *target, Channel *chptr, +int servicebot_can_kick(Client *client, Client *target, Channel *channel, char *comment, long client_flags, long target_flags, char **reject_reason); -int servicebot_mode_deop(Client *client, Client *target, Channel *chptr, +int servicebot_mode_deop(Client *client, Client *target, Channel *channel, u_int what, int modechar, long my_access, char **reject_reason); int servicebot_pre_kill(Client *client, Client *target, char *reason); int servicebot_whois(Client *requester, Client *acptr); -int servicebot_see_channel_in_whois(Client *client, Client *target, Channel *chptr); +int servicebot_see_channel_in_whois(Client *client, Client *target, Channel *channel); MOD_TEST() { @@ -74,7 +74,7 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int servicebot_can_kick(Client *client, Client *target, Channel *chptr, char *comment, +int servicebot_can_kick(Client *client, Client *target, Channel *channel, char *comment, long client_flags, long target_flags, char **reject_reason) { static char errmsg[NICKLEN+256]; @@ -95,12 +95,12 @@ int servicebot_can_kick(Client *client, Client *target, Channel *chptr, char *co return EX_ALLOW; } -int servicebot_mode_deop(Client *client, Client *target, Channel *chptr, +int servicebot_mode_deop(Client *client, Client *target, Channel *channel, u_int what, int modechar, long my_access, char **reject_reason) { static char errmsg[NICKLEN+256]; - if (IsServiceBot(target) && MyUser(client) && !ValidatePermissionsForPath("services:servicebot:deop",client,target,chptr,NULL) && (what == MODE_DEL)) + if (IsServiceBot(target) && MyUser(client) && !ValidatePermissionsForPath("services:servicebot:deop",client,target,channel,NULL) && (what == MODE_DEL)) { snprintf(errmsg, sizeof(errmsg), ":%s %d %s %c :%s is a Service Bot", me.name, ERR_CANNOTCHANGECHANMODE, client->name, (char)modechar, target->name); @@ -134,7 +134,7 @@ int servicebot_whois(Client *requester, Client *acptr) } /* This hides the servicebot, even if you are in the same channel, unless oper overriding */ -int servicebot_see_channel_in_whois(Client *client, Client *target, Channel *chptr) +int servicebot_see_channel_in_whois(Client *client, Client *target, Channel *channel) { if (IsServiceBot(target)) return EX_DENY; diff --git a/src/modules/who_old.c b/src/modules/who_old.c index 1797bff52..df216861e 100644 --- a/src/modules/who_old.c +++ b/src/modules/who_old.c @@ -807,7 +807,7 @@ static char *first_visible_channel(Client *client, Client *acptr, int *flg) for (lp = acptr->user->channel; lp; lp = lp->next) { - Channel *chptr = lp->chptr; + Channel *channel = lp->channel; Hook *h; int ret = EX_ALLOW; int operoverride = 0; @@ -815,12 +815,12 @@ static char *first_visible_channel(Client *client, Client *acptr, int *flg) /* Note that the code below is almost identical to the one in /WHOIS */ - if (ShowChannel(client, chptr)) + if (ShowChannel(client, channel)) showchannel = 1; for (h = Hooks[HOOKTYPE_SEE_CHANNEL_IN_WHOIS]; h; h = h->next) { - int n = (*(h->func.intfunc))(client, acptr, chptr); + int n = (*(h->func.intfunc))(client, acptr, channel); /* Hook return values: * EX_ALLOW means 'yes is ok, as far as modules are concerned' * EX_DENY means 'hide this channel, unless oper overriding' @@ -841,7 +841,7 @@ static char *first_visible_channel(Client *client, Client *acptr, int *flg) if (ret == EX_DENY) showchannel = 0; - if (!showchannel && (ValidatePermissionsForPath("channel:see:who:secret",client,NULL,chptr,NULL) || ValidatePermissionsForPath("channel:see:whois",client,NULL,chptr,NULL))) + if (!showchannel && (ValidatePermissionsForPath("channel:see:who:secret",client,NULL,channel,NULL) || ValidatePermissionsForPath("channel:see:whois",client,NULL,channel,NULL))) { showchannel = 1; /* OperOverride */ operoverride = 1; @@ -857,7 +857,7 @@ static char *first_visible_channel(Client *client, Client *acptr, int *flg) *flg |= FVC_HIDDEN; if (showchannel) - return chptr->chname; + return channel->chname; } /* no channels that they can see */ diff --git a/src/modules/whois.c b/src/modules/whois.c index ce334cef6..dc282860b 100644 --- a/src/modules/whois.c +++ b/src/modules/whois.c @@ -64,7 +64,7 @@ CMD_FUNC(cmd_whois) { Membership *lp; Client *target; - Channel *chptr; + Channel *channel; char *nick, *tmp, *name; char *p = NULL; int found, len, mlen; @@ -159,15 +159,15 @@ CMD_FUNC(cmd_whois) int ret = EX_ALLOW; int operoverride = 0; - chptr = lp->chptr; + channel = lp->channel; showchannel = 0; - if (ShowChannel(client, chptr)) + if (ShowChannel(client, channel)) showchannel = 1; for (h = Hooks[HOOKTYPE_SEE_CHANNEL_IN_WHOIS]; h; h = h->next) { - int n = (*(h->func.intfunc))(client, target, chptr); + int n = (*(h->func.intfunc))(client, target, channel); /* Hook return values: * EX_ALLOW means 'yes is ok, as far as modules are concerned' * EX_DENY means 'hide this channel, unless oper overriding' @@ -188,7 +188,7 @@ CMD_FUNC(cmd_whois) if (ret == EX_DENY) showchannel = 0; - if (!showchannel && (ValidatePermissionsForPath("channel:see:whois",client,NULL,chptr,NULL))) + if (!showchannel && (ValidatePermissionsForPath("channel:see:whois",client,NULL,channel,NULL))) { showchannel = 1; /* OperOverride */ operoverride = 1; @@ -203,7 +203,7 @@ CMD_FUNC(cmd_whois) if (showchannel) { long access; - if (len + strlen(chptr->chname) > (size_t)BUFSIZE - 4 - mlen) + if (len + strlen(channel->chname) > (size_t)BUFSIZE - 4 - mlen) { sendto_one(client, NULL, ":%s %d %s %s :%s", @@ -219,7 +219,7 @@ CMD_FUNC(cmd_whois) /* '?' and '!' both mean we can see the channel in /WHOIS and normally wouldn't, * but there's still a slight difference between the two... */ - if (!PubChannel(chptr)) + if (!PubChannel(channel)) { /* '?' means it's a secret/private channel (too) */ *(buf + len++) = '?'; @@ -231,7 +231,7 @@ CMD_FUNC(cmd_whois) } } - access = get_access(target, chptr); + access = get_access(target, channel); if (!MyUser(client) || !HasCapability(client, "multi-prefix")) { #ifdef PREFIX_AQ @@ -265,8 +265,8 @@ CMD_FUNC(cmd_whois) } if (len) *(buf + len) = '\0'; - (void)strcpy(buf + len, chptr->chname); - len += strlen(chptr->chname); + (void)strcpy(buf + len, channel->chname); + len += strlen(channel->chname); (void)strcat(buf + len, " "); len++; } diff --git a/src/modules/whox.c b/src/modules/whox.c index ae2abf090..732166613 100644 --- a/src/modules/whox.c +++ b/src/modules/whox.c @@ -63,8 +63,8 @@ struct who_format CMD_FUNC(cmd_whox); static void who_global(Client *client, char *mask, int operspy, struct who_format *fmt); -static void do_who(Client *client, Client *acptr, Channel *chptr, struct who_format *fmt); -static void do_who_on_channel(Client *client, Channel *chptr, +static void do_who(Client *client, Client *acptr, Channel *channel, struct who_format *fmt); +static void do_who_on_channel(Client *client, Channel *channel, int member, int operspy, struct who_format *fmt); static int convert_classical_who_request(Client *client, int *parc, char *parv[], char **orig_mask, struct who_format *fmt); @@ -288,15 +288,15 @@ CMD_FUNC(cmd_whox) /* '/who #some_channel' */ if (IsChannelName(mask)) { - Channel *chptr = NULL; + Channel *channel = NULL; /* List all users on a given channel */ - if ((chptr = find_channel(orig_mask, NULL)) != NULL) + if ((channel = find_channel(orig_mask, NULL)) != NULL) { - if (IsMember(client, chptr) || operspy) - do_who_on_channel(client, chptr, 1, operspy, &fmt); - else if (!SecretChannel(chptr)) - do_who_on_channel(client, chptr, 0, operspy, &fmt); + if (IsMember(client, channel) || operspy) + do_who_on_channel(client, channel, 1, operspy, &fmt); + else if (!SecretChannel(channel)) + do_who_on_channel(client, channel, 0, operspy, &fmt); } sendnumeric(client, RPL_ENDOFWHO, mask); @@ -315,26 +315,26 @@ CMD_FUNC(cmd_whox) isinvis = IsInvisible(acptr); for (lp = acptr->user->channel; lp; lp = lp->next) { - member = IsMember(client, lp->chptr); + member = IsMember(client, lp->channel); if (isinvis && !member) continue; for (h = Hooks[HOOKTYPE_VISIBLE_IN_CHANNEL]; h; h = h->next) { - i = (*(h->func.intfunc))(acptr,lp->chptr); + i = (*(h->func.intfunc))(acptr,lp->channel); if (i != 0) break; } - if (i != 0 && !(is_skochanop(client, lp->chptr)) && !(is_skochanop(acptr, lp->chptr) || has_voice(acptr,lp->chptr))) + if (i != 0 && !(is_skochanop(client, lp->channel)) && !(is_skochanop(acptr, lp->channel) || has_voice(acptr,lp->channel))) continue; - if (member || (!isinvis && PubChannel(lp->chptr))) + if (member || (!isinvis && PubChannel(lp->channel))) break; } if (lp != NULL) - do_who(client, acptr, lp->chptr, &fmt); + do_who(client, acptr, lp->channel, &fmt); else do_who(client, acptr, NULL, &fmt); @@ -445,15 +445,15 @@ static int do_match(Client *client, Client *acptr, char *mask, struct who_format * marks matched clients. */ -static void who_common_channel(Client *client, Channel *chptr, +static void who_common_channel(Client *client, Channel *channel, char *mask, int *maxmatches, struct who_format *fmt) { - Member *cm = chptr->members; + Member *cm = channel->members; Client *acptr; Hook *h; int i = 0; - for (cm = chptr->members; cm; cm = cm->next) + for (cm = channel->members; cm; cm = cm->next) { acptr = cm->client; @@ -465,12 +465,12 @@ static void who_common_channel(Client *client, Channel *chptr, for (h = Hooks[HOOKTYPE_VISIBLE_IN_CHANNEL]; h; h = h->next) { - i = (*(h->func.intfunc))(acptr,chptr); + i = (*(h->func.intfunc))(acptr,channel); if (i != 0) break; } - if (i != 0 && !(is_skochanop(client, chptr)) && !(is_skochanop(acptr, chptr) || has_voice(acptr,chptr))) + if (i != 0 && !(is_skochanop(client, channel)) && !(is_skochanop(acptr, channel) || has_voice(acptr,channel))) continue; SetMark(acptr); @@ -514,7 +514,7 @@ static void who_global(Client *client, char *mask, int operspy, struct who_forma Membership *lp; for (lp = client->user->channel; lp; lp = lp->next) - who_common_channel(client, lp->chptr, mask, &maxmatches, fmt); + who_common_channel(client, lp->channel, mask, &maxmatches, fmt); } /* second, list all matching visible clients and clear all marks @@ -563,14 +563,14 @@ static void who_global(Client *client, char *mask, int operspy, struct who_forma * side effects - do a who on given channel */ -static void do_who_on_channel(Client *client, Channel *chptr, +static void do_who_on_channel(Client *client, Channel *channel, int member, int operspy, struct who_format *fmt) { - Member *cm = chptr->members; + Member *cm = channel->members; Hook *h; int i = 0; - for (cm = chptr->members; cm; cm = cm->next) + for (cm = channel->members; cm; cm = cm->next) { Client *acptr = cm->client; @@ -579,16 +579,16 @@ static void do_who_on_channel(Client *client, Channel *chptr, for (h = Hooks[HOOKTYPE_VISIBLE_IN_CHANNEL]; h; h = h->next) { - i = (*(h->func.intfunc))(acptr,chptr); + i = (*(h->func.intfunc))(acptr,channel); if (i != 0) break; } - if (!operspy && (acptr != client) && i != 0 && !(is_skochanop(client, chptr)) && !(is_skochanop(acptr, chptr) || has_voice(acptr,chptr))) + if (!operspy && (acptr != client) && i != 0 && !(is_skochanop(client, channel)) && !(is_skochanop(acptr, channel) || has_voice(acptr,channel))) continue; if(member || !IsInvisible(acptr)) - do_who(client, acptr, chptr, fmt); + do_who(client, acptr, channel, fmt); } } @@ -650,7 +650,7 @@ static int show_ip(Client *client, Client *acptr) * side effects - do a who on given person */ -static void do_who(Client *client, Client *acptr, Channel *chptr, struct who_format *fmt) +static void do_who(Client *client, Client *acptr, Channel *channel, struct who_format *fmt) { char status[20]; char str[510 + 1]; @@ -683,11 +683,11 @@ static void do_who(Client *client, Client *acptr, Channel *chptr, struct who_for if (IsOper(acptr) && (IsHideOper(acptr) && client != acptr && IsOper(client))) status[i++] = '!'; - if (chptr) + if (channel) { Membership *lp; - if ((lp = find_membership_link(acptr->user->channel, chptr))) + if ((lp = find_membership_link(acptr->user->channel, channel))) { if (!(fmt->fields || HasCapability(client, "multi-prefix"))) { @@ -737,7 +737,7 @@ static void do_who(Client *client, Client *acptr, Channel *chptr, struct who_for else host = GetHost(acptr); sendnumeric(client, RPL_WHOREPLY, - chptr ? chptr->chname : "*", + channel ? channel->chname : "*", acptr->user->username, host, hide ? "*" : acptr->user->server, acptr->name, status, hide ? 0 : acptr->hopcount, acptr->info); @@ -749,7 +749,7 @@ static void do_who(Client *client, Client *acptr, Channel *chptr, struct who_for if (HasField(fmt, FIELD_QUERYTYPE)) append_format(str, sizeof str, &pos, " %s", fmt->querytype); if (HasField(fmt, FIELD_CHANNEL)) - append_format(str, sizeof str, &pos, " %s", chptr ? chptr->chname : "*"); + append_format(str, sizeof str, &pos, " %s", channel ? channel->chname : "*"); if (HasField(fmt, FIELD_USER)) append_format(str, sizeof str, &pos, " %s", acptr->user->username); if (HasField(fmt, FIELD_IP)) @@ -790,7 +790,7 @@ static void do_who(Client *client, Client *acptr, Channel *chptr, struct who_for if (HasField(fmt, FIELD_ACCOUNT)) append_format(str, sizeof str, &pos, " %s", (!isdigit(*acptr->user->svid)) ? acptr->user->svid : "0"); if (HasField(fmt, FIELD_OPLEVEL)) - append_format(str, sizeof str, &pos, " %s", (chptr && is_skochanop(acptr, chptr)) ? "999" : "n/a"); + append_format(str, sizeof str, &pos, " %s", (channel && is_skochanop(acptr, channel)) ? "999" : "n/a"); if (HasField(fmt, FIELD_INFO)) append_format(str, sizeof str, &pos, " :%s", acptr->info); diff --git a/src/parse.c b/src/parse.c index 0d5133d01..8c432561f 100644 --- a/src/parse.c +++ b/src/parse.c @@ -461,7 +461,7 @@ void parse2(Client *cptr, Client **fromptr, MessageTag *mtags, char *ch) static int do_numeric(int numeric, Client *client, MessageTag *recv_mtags, int parc, char *parv[]) { Client *acptr; - Channel *chptr; + Channel *channel; char *nick, *p; int i; char buffer[BUFSIZE]; @@ -556,10 +556,10 @@ static int do_numeric(int numeric, Client *client, MessageTag *recv_mtags, int p sendto_prefix_one(acptr, client, recv_mtags, ":%s %d %s%s", client->name, numeric, nick, buffer); } - else if ((chptr = find_channel(nick, NULL))) + else if ((channel = find_channel(nick, NULL))) { - sendto_channel(chptr, client, client, 0, 0, SEND_ALL, recv_mtags, - ":%s %d %s%s", client->name, numeric, chptr->chname, buffer); + sendto_channel(channel, client, client, 0, 0, SEND_ALL, recv_mtags, + ":%s %d %s%s", client->name, numeric, channel->chname, buffer); } } diff --git a/src/send.c b/src/send.c index 214b65d9f..98cebfa0a 100644 --- a/src/send.c +++ b/src/send.c @@ -343,7 +343,7 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick) * Previously there were 6, now there is 1. This means there * are likely some parameters that you will pass as NULL or 0 * but at least we can all use one single function. - * @param chptr The channel to send to + * @param channel The channel to send to * @param from The source of the message * @param skip The client to skip (can be NULL) * @param prefix Any combination of PREFIX_* (can be 0 for all) @@ -357,7 +357,7 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick) * @param pattern The pattern (eg: ":%s PRIVMSG %s :%s") * @param ... The parameters for the pattern. */ -void sendto_channel(Channel *chptr, Client *from, Client *skip, +void sendto_channel(Channel *channel, Client *from, Client *skip, int prefix, long clicap, int sendflags, MessageTag *mtags, FORMAT_STRING(const char *pattern), ...) @@ -367,7 +367,7 @@ void sendto_channel(Channel *chptr, Client *from, Client *skip, Client *acptr; ++current_serial; - for (lp = chptr->members; lp; lp = lp->next) + for (lp = channel->members; lp; lp = lp->next) { acptr = lp->client; @@ -438,7 +438,7 @@ good: */ if ((iConf.broadcast_channel_messages == BROADCAST_CHANNEL_MESSAGES_ALWAYS) || - ((iConf.broadcast_channel_messages == BROADCAST_CHANNEL_MESSAGES_AUTO) && has_channel_mode(chptr, 'H'))) + ((iConf.broadcast_channel_messages == BROADCAST_CHANNEL_MESSAGES_AUTO) && has_channel_mode(channel, 'H'))) { list_for_each_entry(acptr, &server_list, special_node) { @@ -537,7 +537,7 @@ void sendto_local_common_channels(Client *user, Client *skip, long clicap, Messa { for (channels = user->user->channel; channels; channels = channels->next) { - for (users = channels->chptr->members; users; users = users->next) + for (users = channels->channel->members; users; users = users->next) { acptr = users->client; @@ -553,7 +553,7 @@ void sendto_local_common_channels(Client *user, Client *skip, long clicap, Messa if (acptr == skip) continue; /* the one to skip */ - if (!user_can_see_member(acptr, user, channels->chptr)) + if (!user_can_see_member(acptr, user, channels->channel)) continue; /* the sending user (quit'ing or nick changing) is 'invisible' -- skip */ acptr->local->serial = current_serial;