Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Commit

Permalink
add usermode for webchat users
Browse files Browse the repository at this point in the history
Closes #54

Make format string for RPL_WHOISWEBCLIENT include target

Closes #62
  • Loading branch information
Xe committed Apr 3, 2015
1 parent 671c21d commit c3d0ff4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 7 deletions.
3 changes: 3 additions & 0 deletions extensions/m_webirc.c
Expand Up @@ -130,6 +130,9 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
}
}

/* Set UMODE_WEBCLIENT */
source_p->umodes = source_p->umodes | UMODE_WEBCLIENT;

sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]);
return 0;
}
1 change: 1 addition & 0 deletions help/opers/umode
Expand Up @@ -28,3 +28,4 @@ User modes: (* designates that the umode is oper only)
+I - Prevents non-opers from seeing your channel list in
a whois query.
+Z - Is connected via SSL (set only on connection).
+W - Is connected via a web client (set only on connection).
1 change: 1 addition & 0 deletions help/users/umode
Expand Up @@ -22,3 +22,4 @@ User modes: (? designates that the umode is provided by an extension
anyone who's in a common channel with you to message you.
+V - Prevents you from receiving invites.
+Z - Is connected via SSL (set only on connection).
+W - Is connected via a web client (set only on connection).
1 change: 1 addition & 0 deletions include/client.h
Expand Up @@ -425,6 +425,7 @@ struct ListClient {
#define UMODE_OPER 0x1000 /* Operator */
#define UMODE_ADMIN 0x2000 /* Admin on server */
#define UMODE_SSLCLIENT 0x4000 /* using SSL */
#define UMODE_WEBCLIENT 0x100000 /* user is connected via a web client */
#define UMODE_OVERRIDE 0x20000 /* able to override */

#define IsOverride(x) ((x)->umodes & UMODE_OVERRIDE)
Expand Down
1 change: 1 addition & 0 deletions include/numeric.h
Expand Up @@ -330,6 +330,7 @@ extern const char *form_str(int);
#define ERR_HELPNOTFOUND 524

#define RPL_WHOISSECURE 671 /* Unreal3.2 --nenolod */
#define RPL_WHOISWEBIRC 672 /* plexus -- Xe */

#define RPL_MODLIST 702
#define RPL_ENDOFMODLIST 703
Expand Down
6 changes: 6 additions & 0 deletions modules/m_whois.c
Expand Up @@ -313,6 +313,12 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
if(IsSSLClient(target_p))
sendto_one_numeric(source_p, RPL_WHOISSECURE, form_str(RPL_WHOISSECURE),
target_p->name);

if(!(target_p->umodes & UMODE_WEBCLIENT)) {
sendto_one_numeric(source_p, RPL_WHOISWEBIRC, form_str(RPL_WHOISWEBIRC),
target_p->name);
}

if((source_p == target_p || IsOper(source_p)) &&
target_p->certfp != NULL)
sendto_one_numeric(source_p, RPL_WHOISCERTFP,
Expand Down
2 changes: 1 addition & 1 deletion src/messages.tab
Expand Up @@ -693,7 +693,7 @@ static const char * replies[] = {
/* 669 */ NULL,
/* 670 */ NULL,
/* 671 RPL_WHOISSECURE, */ "%s :is using a secure connection",
/* 672 */ NULL,
/* 672 RPL_WHOISWEBIRC, */ "%s :is using a web IRC client",
/* 673 */ NULL,
/* 674 */ NULL,
/* 675 */ NULL,
Expand Down
13 changes: 7 additions & 6 deletions src/s_user.c
Expand Up @@ -88,7 +88,7 @@ int user_modes[256] = {
0, /* T */
0, /* U */
UMODE_NOINVITE, /* V */
0, /* W */
UMODE_WEBCLIENT, /* W */
0, /* X */
0, /* Y */
UMODE_SSLCLIENT, /* Z */
Expand Down Expand Up @@ -1011,13 +1011,14 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
}
break;

/* we may not get these,
* but they shouldnt be in default
*/
/* we may not get these,
* but they shouldnt be in default
*/

/* can only be set on burst */
/* can only be set on burst */
case 'S':
case 'Z':
case 'W':
case ' ':
case '\n':
case '\r':
Expand Down Expand Up @@ -1046,7 +1047,7 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
source_p->umodes &= ~UMODE_SERVNOTICE;
break;
}
/* FALLTHROUGH */
/* FALLTHROUGH */
default:
if (MyConnect(source_p) && *pm == 'Q' && !ConfigChannel.use_forward) {
badflag = YES;
Expand Down

0 comments on commit c3d0ff4

Please sign in to comment.