Skip to content

Commit 0846fb7

Browse files
committed
Address review comments
1 parent 1606632 commit 0846fb7

File tree

4 files changed

+14
-38
lines changed

4 files changed

+14
-38
lines changed

doc/reference.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,10 +1557,10 @@ general {
15571557
#apply_msg = "You have been quarantined and must log into your NickServ account before you can join channels. Please see /STATS p for assistance.";
15581558

15591559
/* join_reason: Message displayed to quarantined users when they are denied JOINing a channel */
1560-
#join_reason = "Cannot join channel (+q) - you need to be logged into your NickServ account";
1560+
#join_reason = "Cannot join channel (usermode +q) - you need to be logged into your NickServ account";
15611561

15621562
/* msg_reason: Message displayed to quarantined users when they are denied messaging a nick/channel */
1563-
#msg_reason = "Cannot send to nick/channel (+q) - you need to be logged into your NickServ account";
1563+
#msg_reason = "Cannot send to nick/channel (usermode +q) - you need to be logged into your NickServ account";
15641564

15651565
/* other_msg_reason: Message displayed to other users when they are denied messaging a quarantined user */
15661566
#other_msg_reason = "they are quarantined and will be unable to respond to you";

extensions/m_quarantine.c

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636

3737
#define IsOperQuarantine(x) (HasPrivilege((x), "oper:quarantine"))
3838
#define IsQuarantined(x) ((x)->umodes & user_modes['q'])
39-
#define DEFAULT_JOIN_REASON "Cannot join channel (+q) - you need to be logged into your NickServ account"
40-
#define DEFAULT_MSG_REASON "Cannot send to nick/channel (+q) - you need to be logged into your NickServ account"
39+
#define DEFAULT_JOIN_REASON "Cannot join channel (usermode +q) - you need to be logged into your NickServ account"
40+
#define DEFAULT_MSG_REASON "Cannot send to nick/channel (usermode +q) - you need to be logged into your NickServ account"
4141
#define DEFAULT_OTHER_MSG_REASON "they are quarantined and will be unable to respond to you"
4242
#define DEFAULT_APPLY_MSG "You have been quarantined and must log into your NickServ account before you can join channels. Please see /STATS p for assistance."
4343
#define DEFAULT_REMOVE_MSG "You are no longer quarantined and can freely join channels."
@@ -74,12 +74,12 @@ static void quarantine_set_allow_channels(void *);
7474

7575
struct Message quarantine_msgtab = {
7676
"QUARANTINE", 0, 0, 0, 0,
77-
{ mg_unreg, mg_not_oper, mg_not_oper, mg_ignore, { me_quarantine, 2 }, { mo_quarantine, 2 } }
77+
{ mg_unreg, mg_not_oper, mg_not_oper, mg_ignore, { me_quarantine, 3 }, { mo_quarantine, 3 } }
7878
};
7979

8080
struct Message unquarantine_msgtab = {
8181
"UNQUARANTINE", 0, 0, 0, 0,
82-
{ mg_unreg, mg_not_oper, mg_not_oper, mg_ignore, { me_unquarantine, 1 }, { mo_unquarantine, 1 } }
82+
{ mg_unreg, mg_not_oper, mg_not_oper, mg_ignore, { me_unquarantine, 2 }, { mo_unquarantine, 2 } }
8383
};
8484

8585
struct ConfEntry conf_quarantine_table[] = {
@@ -149,12 +149,6 @@ mo_quarantine(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *s
149149
return;
150150
}
151151

152-
if (parc < 3 || EmptyString(parv[1]) || EmptyString(parv[2]))
153-
{
154-
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "QUARANTINE");
155-
return;
156-
}
157-
158152
struct Client *target_p = find_named_person(parv[1]);
159153
if (target_p == NULL)
160154
{
@@ -172,12 +166,6 @@ mo_quarantine(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *s
172166
static void
173167
me_quarantine(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
174168
{
175-
if (parc < 3 || EmptyString(parv[1]) || EmptyString(parv[2]))
176-
{
177-
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "QUARANTINE");
178-
return;
179-
}
180-
181169
struct Client *target_p = find_named_person(parv[1]);
182170
if (target_p == NULL)
183171
{
@@ -200,12 +188,6 @@ mo_unquarantine(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client
200188
return;
201189
}
202190

203-
if (parc < 2 || EmptyString(parv[1]))
204-
{
205-
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "UNQUARANTINE");
206-
return;
207-
}
208-
209191
struct Client *target_p = find_named_person(parv[1]);
210192
if (target_p == NULL)
211193
{
@@ -223,12 +205,6 @@ mo_unquarantine(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client
223205
static void
224206
me_unquarantine(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
225207
{
226-
if (parc < 2 || EmptyString(parv[1]))
227-
{
228-
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "UNQUARANTINE");
229-
return;
230-
}
231-
232208
struct Client *target_p = find_named_person(parv[1]);
233209
if (target_p == NULL)
234210
{
@@ -514,8 +490,8 @@ quarantine_privmsg_channel(void *data_)
514490

515491
data->approved = ERR_CANNOTSENDTOCHAN;
516492

517-
/* Don't give error messages for TAGMSG since many clients autogenerate these (e.g. +typing) */
518-
if (data->msgtype != MESSAGE_TYPE_TAGMSG)
493+
/* Don't give error messages for non-PRIVMSG since many clients autogenerate these (e.g. +typing) */
494+
if (data->msgtype == MESSAGE_TYPE_PRIVMSG)
519495
sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, "%s :%s",
520496
data->chptr->chname,
521497
EmptyString(msg_reason) ? DEFAULT_MSG_REASON : msg_reason);
@@ -536,7 +512,7 @@ quarantine_privmsg_user(void *data_)
536512
{
537513
if (IsQuarantined(data->target_p) && !IsOper(data->source_p) && !IsService(data->source_p))
538514
{
539-
if (data->msgtype != MESSAGE_TYPE_TAGMSG)
515+
if (data->msgtype == MESSAGE_TYPE_PRIVMSG)
540516
sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOUSER, form_str(ERR_CANNOTSENDTOUSER),
541517
data->target_p->name,
542518
EmptyString(other_msg_reason) ? DEFAULT_OTHER_MSG_REASON : other_msg_reason);
@@ -551,8 +527,8 @@ quarantine_privmsg_user(void *data_)
551527

552528
data->approved = ERR_CANNOTSENDTOCHAN;
553529

554-
/* Don't give error messages for TAGMSG since many clients autogenerate these (e.g. +typing) */
555-
if (data->msgtype != MESSAGE_TYPE_TAGMSG)
530+
/* Don't give error messages for non-PRIVMSG since many clients autogenerate these (e.g. +typing) */
531+
if (data->msgtype == MESSAGE_TYPE_PRIVMSG)
556532
sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, "%s :%s",
557533
data->target_p->name,
558534
EmptyString(msg_reason) ? DEFAULT_MSG_REASON : msg_reason);

modules/m_services.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ me_su(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
139139
if(!target_p->user)
140140
return;
141141

142-
strncpy(old_suser, target_p->user->suser, sizeof(old_suser) - 1);
142+
rb_strlcpy(old_suser, target_p->user->suser, sizeof(old_suser));
143143

144144
if(EmptyString(parv[2]))
145145
target_p->user->suser[0] = '\0';
@@ -173,7 +173,7 @@ me_login(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
173173
if(!IsPerson(source_p))
174174
return;
175175

176-
strncpy(old_suser, source_p->user->suser, sizeof(old_suser) - 1);
176+
rb_strlcpy(old_suser, source_p->user->suser, sizeof(old_suser));
177177
rb_strlcpy(source_p->user->suser, parv[1], sizeof(source_p->user->suser));
178178
hook_cdata hdata = { source_p, old_suser, NULL };
179179
call_hook(h_account_change, &hdata);

modules/m_signon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ send_signon(struct Client *client_p, struct Client *target_p,
417417
use_id(target_p), nick, user, host,
418418
(long) target_p->tsinfo, *login ? login : "0");
419419

420-
strncpy(old_suser, target_p->user->suser, sizeof(old_suser) - 1);
420+
rb_strlcpy(old_suser, target_p->user->suser, sizeof(old_suser));
421421
rb_strlcpy(target_p->user->suser, login, sizeof(target_p->user->suser));
422422

423423
if (irccmp(target_p->orighost, host))

0 commit comments

Comments
 (0)