repo: ngircd
action: commit
revision: 
path_from: 
revision_from: f37600ee01f6cfd86e8fa80f77ee26ebaf3012b2:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit f37600ee01f6cfd86e8fa80f77ee26ebaf3012b2
Merge: f38a9035 097c72aa
Author: Alexander Barton 
Date:   Tue Sep 11 12:30:19 2012 +0200

    Merge branch 'xop' of https://github.com/kart0ffelsack/ngircd into bug92-xop

    * 'xop' of https://github.com/kart0ffelsack/ngircd:
      Tests and documentation for xop
      Implemented xop support

    Conflicts (because of merge of the 'cmode-M' branch):
            src/ngircd/channel.c
            src/ngircd/defines.h
            src/ngircd/messages.h

diff --cc src/ngircd/channel.c
index f0a9525d348a5d992596f453fd9ba709cbd47c9a,90d2efab3e191f7ef1f3931bb1f2de6e90e5837d..8d001a825c013e8c77e339f5915a54eac792b6fa
--- a/src/ngircd/channel.c
+++ b/src/ngircd/channel.c
@@@ -837,11 -877,7 +882,11 @@@ Can_Send_To_Channel(CHANNEL *Chan, CLIE
  	if (strchr(Channel_Modes(Chan), 'n') && !is_member)
  		return false;

 +	if (strchr(Channel_Modes(Chan), 'M') && !Client_HasMode(From, 'R')
 +	    && !Client_HasMode(From, 'o'))
 +		return false;
 +
- 	if (is_op || has_voice)
+ 	if (has_voice || is_halfop || is_op || is_chanadmin || is_owner)
  		return true;

  	if (strchr(Channel_Modes(Chan), 'm'))
diff --cc src/ngircd/defines.h
index 82837599aadbb6485f0f044b447739d7b5f922fa,d0dc9ce18862f742617caed8c69579007303ec8a..ba7adf17adb204840418b7482b75fef975844138
--- a/src/ngircd/defines.h
+++ b/src/ngircd/defines.h
@@@ -161,10 -161,10 +161,10 @@@
  #endif

  /** Supported user modes. */
 -#define USERMODES "acCiorRswx"
 +#define USERMODES "aBcCiorRswx"

  /** Supported channel modes. */
- #define CHANMODES "beiIklmMnoOPrRstvz"
 -#define CHANMODES "abehiIklmnoOPqrRstvz"
++#define CHANMODES "abehiIklmMnoOPqrRstvz"

  /** Away message for users connected to linked servers. */
  #define DEFAULT_AWAY_MSG "Away"
diff --cc src/ngircd/irc-mode.c
index 71557201d8d938f4a5ff65416f50eb487f78333d,3679531d6963909502bf1895c2ea3dc6a0801052..f39463433ce5261b0d3736174845f92aadb21e76
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@@ -521,15 -527,22 +549,23 @@@ Channel_Mode(CLIENT *Client, REQUEST *R
  		client = NULL;
  		switch (*mode_ptr) {
  		/* --- Channel modes --- */
+ 		case 'R': /* Registered users only */
+ 		case 's': /* Secret channel */
+ 		case 'z': /* Secure connections only */
+ 			if(!is_oper && !is_machine && !is_owner &&
+ 			   !is_admin && !is_op) {
+ 				connected = IRC_WriteStrClient(Origin,
+ 					ERR_CHANOPRIVSNEEDED_MSG,
+ 					Client_ID(Origin), Channel_Name(Channel));
+ 				goto chan_exit;
+ 			}
  		case 'i': /* Invite only */
 +		case 'M': /* Only identified nicks can write */
  		case 'm': /* Moderated */
  		case 'n': /* Only members can write */
- 		case 'R': /* Registered users only */
- 		case 's': /* Secret channel */
  		case 't': /* Topic locked */
- 		case 'z': /* Secure connections only */
- 			if (modeok)
+ 			if(is_oper || is_machine || is_owner ||
+ 			   is_admin || is_op || is_halfop)
  				x[0] = *mode_ptr;
  			else
  				connected = IRC_WriteStrClient(Origin,
diff --cc src/ngircd/messages.h
index 4f3a397b2647eabc6fd6ed21f9aa31d776df69e9,d8041bfd761e3d5dc621eca2864939118b778049..d99930faa5d079995932ba3140d207c08e20e5c9
--- a/src/ngircd/messages.h
+++ b/src/ngircd/messages.h
@@@ -21,7 -21,7 +21,7 @@@
  #define RPL_YOURHOST_MSG		"002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
  #define RPL_CREATED_MSG			"003 %s :This server has been started %s"
  #define RPL_MYINFO_MSG			"004 %s %s ngircd-%s %s %s"
- #define RPL_ISUPPORT1_MSG		"005 %s RFC2812 IRCD=ngIRCd CASEMAPPING=ascii PREFIX=(ov)@+ CHANTYPES=#&+ CHANMODES=beI,k,l,imMnOPRstz CHANLIMIT=#&+:%d :are supported on this server"
 -#define RPL_ISUPPORT1_MSG		"005 %s RFC2812 IRCD=ngIRCd CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=#&+ CHANMODES=beI,k,l,imnOPRstz CHANLIMIT=#&+:%d :are supported on this server"
++#define RPL_ISUPPORT1_MSG		"005 %s RFC2812 IRCD=ngIRCd CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=#&+ CHANMODES=beI,k,l,imMnOPRstz CHANLIMIT=#&+:%d :are supported on this server"
  #define RPL_ISUPPORT2_MSG		"005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server"

  #define RPL_TRACELINK_MSG		"200 %s Link %s-%s %s %s V%s %ld %d %d"
@@@ -138,9 -135,9 +138,10 @@@
  #define ERR_LISTFULL_MSG		"478 %s %s %s: Channel list is full (%d)"
  #define ERR_NOPRIVILEGES_MSG		"481 %s :Permission denied"
  #define ERR_CHANOPRIVSNEEDED_MSG	"482 %s %s :You are not channel operator"
+ #define ERR_CHANOPPRIVTOLOW_MSG		"482 %s %s :Your privileges are to low"
  #define ERR_CANTKILLSERVER_MSG		"483 %s :You can't kill a server!"
  #define ERR_RESTRICTED_MSG		"484 %s :Your connection is restricted"
 +#define ERR_NICKREGISTER_MSG		"484 %s :Cannot modify user mode (+R) -- Use IRC services"
  #define ERR_NOOPERHOST_MSG		"491 %s :Not configured for your host"
  #define ERR_NOTONSAMECHANNEL_MSG	"493 %s :You must share a common channel with %s"

-----END OF PAGE-----