X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/cc200171d7c40be3b204460f9c14d5d37e771866..e78f68507356cd9f9a5bf9c03c9db61a7d00b9f4:/modules/core/m_part.c diff --git a/modules/core/m_part.c b/modules/core/m_part.c index 0557002..09ff236 100644 --- a/modules/core/m_part.c +++ b/modules/core/m_part.c @@ -29,7 +29,7 @@ #include "client.h" #include "common.h" #include "hash.h" -#include "irc_string.h" +#include "match.h" #include "ircd.h" #include "numeric.h" #include "send.h" @@ -39,6 +39,7 @@ #include "modules.h" #include "s_conf.h" #include "packet.h" +#include "inline/stringops.h" static int m_part(struct Client *, struct Client *, int, const char **); @@ -57,7 +58,6 @@ static void part_one_client(struct Client *client_p, /* ** m_part -** parv[0] = sender prefix ** parv[1] = channel ** parv[2] = reason */ @@ -71,20 +71,18 @@ m_part(struct Client *client_p, struct Client *source_p, int parc, const char *p reason[0] = '\0'; if(parc > 2) - strlcpy(reason, parv[2], sizeof(reason)); + rb_strlcpy(reason, parv[2], sizeof(reason)); - name = strtoken(&p, s, ","); + name = rb_strtok_r(s, ",", &p); /* Finish the flood grace period... */ if(MyClient(source_p) && !IsFloodDone(source_p)) flood_endgrace(source_p); - strip_colour(reason); - while(name) { part_one_client(client_p, source_p, name, reason); - name = strtoken(&p, NULL, ","); + name = rb_strtok_r(NULL, ",", &p); } return 0; } @@ -103,6 +101,7 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, ch { struct Channel *chptr; struct membership *msptr; + char reason2[BUFSIZE]; if((chptr = find_channel(name)) == NULL) { @@ -124,15 +123,19 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, ch * Remove user from the old channel (if any) * only allow /part reasons in -m chans */ - if(reason[0] && (is_chanop(msptr) || !MyConnect(source_p) || - ((can_send(chptr, source_p, msptr) > 0 && + if(reason[0] && (is_any_op(msptr) || !MyConnect(source_p) || + ((can_send(chptr, source_p, msptr) > 0 && ConfigFileEntry.use_part_messages && (source_p->localClient->firsttime + - ConfigFileEntry.anti_spam_exit_message_time) < CurrentTime)))) + ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) { + if(chptr->mode.mode & MODE_NOCOLOR && (!ConfigChannel.exempt_cmode_c || !is_any_op(msptr))) + { + rb_strlcpy(reason2, reason, BUFSIZE); + strip_colour(reason2); + reason = reason2; + } sendto_server(client_p, chptr, CAP_TS6, NOCAPS, ":%s PART %s :%s", use_id(source_p), chptr->chname, reason); - sendto_server(client_p, chptr, NOCAPS, CAP_TS6, - ":%s PART %s :%s", source_p->name, chptr->chname, reason); sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s", source_p->name, source_p->username, source_p->host, chptr->chname, reason); @@ -141,8 +144,6 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, ch { sendto_server(client_p, chptr, CAP_TS6, NOCAPS, ":%s PART %s", use_id(source_p), chptr->chname); - sendto_server(client_p, chptr, NOCAPS, CAP_TS6, - ":%s PART %s", source_p->name, chptr->chname); sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s", source_p->name, source_p->username, source_p->host, chptr->chname);