diff --git a/help/opers/umode b/help/opers/umode index 9e28521..4e8db08 100644 --- a/help/opers/umode +++ b/help/opers/umode @@ -6,6 +6,8 @@ Usermodes: (* designates that the umode is oper only) ----------------------------------------------------------------- +i - Designates this client 'invisible'. +g - "caller id" mode only allow accept clients to message you + +G - "soft caller id" mode - same as +g but automatically allows + anyone who's in a common channel with you to message you. +w - Can see oper and server wallops. +o - Designates this client is an IRC Operator. Use the /oper command to attain this. diff --git a/help/users/umode b/help/users/umode index 55e777a..1901000 100644 --- a/help/users/umode +++ b/help/users/umode @@ -8,6 +8,8 @@ Usermodes: Use the /oper command to attain this. +i - Designates this client 'invisible'. +g - "caller id" mode only allow accept clients to message you + +G - "soft caller id" mode - same as +g but automatically allows + anyone who's in a common channel with you to message you. +w - Can see oper wallops. +B - Marks you as a bot in /whois. +C - Prevents you from receiving CTCPs other than ACTION. diff --git a/include/client.h b/include/client.h index 362ccb1..c74af9d 100644 --- a/include/client.h +++ b/include/client.h @@ -424,6 +424,7 @@ struct ListClient #define UMODE_NOCTCP 0x0400 /* block CTCPs except for ACTION */ #define UMODE_NOINVITE 0x0800 /* block invites */ #define UMODE_BOT 0x8000 /* mark as a bot in whois */ +#define UMODE_SCALLERID 0x40000 /* soft caller id */ /* user information flags, only settable by remote mode or local oper */ #define UMODE_OPER 0x1000 /* Operator */ @@ -523,6 +524,7 @@ struct ListClient #define IsSetNoCTCP(x) ((x)->umodes & UMODE_NOCTCP) #define IsSetNoInvite(x) ((x)->umodes & UMODE_NOINVITE) #define IsSetBot(x) ((x)->umodes & UMODE_BOT) +#define IsSetSCallerId(x) ((x)->umodes & UMODE_SCALLERID) #define SetGotId(x) ((x)->flags |= FLAGS_GOTID) #define IsGotId(x) (((x)->flags & FLAGS_GOTID) != 0) diff --git a/include/numeric.h b/include/numeric.h index 3b9f30f..0326926 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -368,6 +368,8 @@ extern const char *form_str(int); #define RPL_ENDOFMONLIST 733 #define ERR_MONLISTFULL 734 +#define ERR_NOCOMMONCHAN 737 + #define RPL_RSACHALLENGE2 740 #define RPL_ENDOFRSACHALLENGE2 741 diff --git a/modules/core/m_message.c b/modules/core/m_message.c index f855f4d..2415bb2 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -777,39 +777,46 @@ msg_client(int p_or_n, const char *command, source_p->name, source_p->username, source_p->host, command, target_p->name, text); + return; } - else if (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0]) + if (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0]) { if (p_or_n != NOTICE) sendto_one_numeric(source_p, ERR_NONONREG, form_str(ERR_NONONREG), target_p->name); + return; } - else + if (IsSetSCallerId(target_p) && !source_p->user->suser[0]) + { + if (p_or_n != NOTICE) + sendto_one_numeric(source_p, ERR_NOCOMMONCHAN, + form_str(ERR_NOCOMMONCHAN), + target_p->name); + return; + } + /* check for accept, flag recipient incoming message */ + if(p_or_n != NOTICE) + { + sendto_one_numeric(source_p, ERR_TARGUMODEG, + form_str(ERR_TARGUMODEG), + target_p->name); + } + + if((target_p->localClient->last_caller_id_time + + ConfigFileEntry.caller_id_wait) < rb_current_time()) { - /* check for accept, flag recipient incoming message */ if(p_or_n != NOTICE) - { - sendto_one_numeric(source_p, ERR_TARGUMODEG, - form_str(ERR_TARGUMODEG), + sendto_one_numeric(source_p, RPL_TARGNOTIFY, + form_str(RPL_TARGNOTIFY), target_p->name); - } - if((target_p->localClient->last_caller_id_time + - ConfigFileEntry.caller_id_wait) < rb_current_time()) - { - if(p_or_n != NOTICE) - sendto_one_numeric(source_p, RPL_TARGNOTIFY, - form_str(RPL_TARGNOTIFY), - target_p->name); + add_reply_target(target_p, source_p); + sendto_one(target_p, form_str(RPL_UMODEGMSG), + me.name, target_p->name, source_p->name, + source_p->username, source_p->host); - add_reply_target(target_p, source_p); - sendto_one(target_p, form_str(RPL_UMODEGMSG), - me.name, target_p->name, source_p->name, - source_p->username, source_p->host); - - target_p->localClient->last_caller_id_time = rb_current_time(); - } + target_p->localClient->last_caller_id_time = rb_current_time(); } } else diff --git a/src/messages.tab b/src/messages.tab index 2ce9399..af25afd 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -758,7 +758,7 @@ static const char * replies[] = { /* 734 ERR_MONLISTFULL */ ":%s 734 %s %d %s :Monitor list is full", /* 735 */ NULL, /* 736 */ NULL, -/* 737 */ NULL, +/* 737 ERR_NOCOMMONCHAN*/ "%s :is in +G mode (server-side ignore) and you do not share a common channel with them.", /* 738 */ NULL, /* 739 */ NULL, /* 740 */ ":%s 740 %s :%s", diff --git a/src/newconf.c b/src/newconf.c index c17f621..482fd45 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -295,6 +295,7 @@ struct mode_table /* *INDENT-OFF* */ static struct mode_table umode_table[] = { {"callerid", UMODE_CALLERID }, + {"softcallerid", UMODE_SCALLERID }, {"deaf", UMODE_DEAF }, {"invisible", UMODE_INVISIBLE }, {"locops", UMODE_LOCOPS }, diff --git a/src/s_user.c b/src/s_user.c index fccd29d..198249c 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -73,7 +73,7 @@ int user_modes[256] = { UMODE_DEAF, /* D */ 0, /* E */ 0, /* F */ - 0, /* G */ + UMODE_SCALLERID, /* G */ 0, /* H */ 0, /* I */ 0, /* J */