diff options
| author | Alexander Barton <alex@barton.de> | 2012-09-23 19:58:50 +0200 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2012-09-23 20:06:14 +0200 |
| commit | e3e181f4b3eae0e552632bce19bdff990196938f (patch) | |
| tree | c20c120684ea51e14fbcec1cb25ba5b38026707e /src/ngircd/irc-server.c | |
| parent | ef82ef4ddb8b93e3d02197ffeed977d76dd99ba5 (diff) | |
| parent | 1f2aa4da6f62124bdbed4f2dce7e40ed4b411e2a (diff) | |
| download | ngircd-e3e181f4b3eae0e552632bce19bdff990196938f.tar.gz ngircd-e3e181f4b3eae0e552632bce19bdff990196938f.zip | |
Merge branch 'bug92-xop'
By Alexander Barton (5) and Sebastian Köhler (2) * bug92-xop: Fix NAMES/WHO response when client has multi-prefix Fix prefix of "halfop" when "multi-prefix" is active Clean up doc/.gitignore doc/Modes.txt: add version number to new channel modes Fix some "whitespace glitches" Tests and documentation for xop Implemented xop support Conflicts (because of "multi-prefix fix"): src/ngircd/irc-info.c This fixes bug #92 "ngircd does not support XOP usermodes".
Diffstat (limited to 'src/ngircd/irc-server.c')
| -rw-r--r-- | src/ngircd/irc-server.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/ngircd/irc-server.c b/src/ngircd/irc-server.c index 8526a573..380ab622 100644 --- a/src/ngircd/irc-server.c +++ b/src/ngircd/irc-server.c @@ -54,7 +54,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req ) CLIENT *from, *c; int i; CONN_ID con; - + assert( Client != NULL ); assert( Req != NULL ); @@ -88,7 +88,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req ) Conn_Close( Client_Conn( Client ), NULL, "Bad password", true); return DISCONNECTED; } - + /* Is there a registered server with this ID? */ if( ! Client_CheckID( Client, Req->argv[0] )) return DISCONNECTED; @@ -203,10 +203,10 @@ GLOBAL bool IRC_NJOIN( CLIENT *Client, REQUEST *Req ) { char nick_in[COMMAND_LEN], nick_out[COMMAND_LEN], *channame, *ptr, modes[8]; - bool is_op, is_voiced; + bool is_owner, is_chanadmin, is_op, is_halfop, is_voiced; CHANNEL *chan; CLIENT *c; - + assert( Client != NULL ); assert( Req != NULL ); @@ -220,11 +220,15 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req ) while( ptr ) { is_op = is_voiced = false; - + /* cut off prefixes */ - while(( *ptr == '@' ) || ( *ptr == '+' )) + while(( *ptr == '~') || ( *ptr == '&' ) || ( *ptr == '@' ) || + ( *ptr == '%') || ( *ptr == '+' )) { + if( *ptr == '~' ) is_owner = true; + if( *ptr == '&' ) is_chanadmin = true; if( *ptr == '@' ) is_op = true; + if( *ptr == 'h' ) is_halfop = true; if( *ptr == '+' ) is_voiced = true; ptr++; } @@ -235,8 +239,11 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req ) Channel_Join( c, channame ); chan = Channel_Search( channame ); assert( chan != NULL ); - + + if( is_owner ) Channel_UserModeAdd( chan, c, 'q' ); + if( is_chanadmin ) Channel_UserModeAdd( chan, c, 'a' ); if( is_op ) Channel_UserModeAdd( chan, c, 'o' ); + if( is_halfop ) Channel_UserModeAdd( chan, c, 'h' ); if( is_voiced ) Channel_UserModeAdd( chan, c, 'v' ); /* announce to channel... */ @@ -251,12 +258,15 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req ) } if( nick_out[0] != '\0' ) strlcat( nick_out, ",", sizeof( nick_out )); + if( is_owner ) strlcat( nick_out, "~", sizeof( nick_out )); + if( is_chanadmin ) strlcat( nick_out, "&", sizeof( nick_out )); if( is_op ) strlcat( nick_out, "@", sizeof( nick_out )); + if( is_halfop ) strlcat( nick_out, "%", sizeof( nick_out )); if( is_voiced ) strlcat( nick_out, "+", sizeof( nick_out )); strlcat( nick_out, ptr, sizeof( nick_out )); } else Log( LOG_ERR, "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!", ptr, channame ); - + /* search for next Nick */ ptr = strtok( NULL, "," ); } |