Add umode +G, soft callerid.

This commit is contained in:
B.Greenham 2010-02-25 17:57:12 -05:00
parent ffffcf7321
commit 61ffa214b4
8 changed files with 39 additions and 23 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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",

View File

@ -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 },

View File

@ -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 */