]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-mode.c
Rename ClientHost to CloakHost, and ClientUserNick to CloakUserToNick
[ngircd-alex.git] / src / ngircd / irc-mode.c
index 1e6772a69e636a6288ecf1393cf8db96eff7df47..50b0db0476cf4eab116d8192606843ac0c351fe2 100644 (file)
@@ -7,13 +7,15 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
- *
- * IRC commands for mode changes (MODE, AWAY, ...)
  */
 
-
 #include "portab.h"
 
+/**
+ * @file
+ * IRC commands for mode changes (like MODE, AWAY, etc.)
+ */
+
 #include "imp.h"
 #include <assert.h>
 #include <stdio.h>
@@ -202,7 +204,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
 
                        case 'x': /* Cloak hostname */
                                if (Client_HasMode(Client, 'r'))
-                                       IRC_WriteStrClient(Origin,
+                                       ok = IRC_WriteStrClient(Origin,
                                                           ERR_RESTRICTED_MSG,
                                                           Client_ID(Origin));
                                else
@@ -499,6 +501,23 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                goto chan_exit;
                        }
                        break;
+               case 'O': /* IRC operators only */
+                       if (modeok) {
+                               /* Only IRC operators are allowed to
+                                * set the 'O' channel mode! */
+                               if (set && !(Client_OperByMe(Client)
+                                   || Client_Type(Client) == CLIENT_SERVER))
+                                       connected = IRC_WriteStrClient(Origin,
+                                               ERR_NOPRIVILEGES_MSG,
+                                               Client_ID(Origin));
+                               else
+                                       x[0] = 'O';
+                       } else
+                               connected = IRC_WriteStrClient(Origin,
+                                               ERR_CHANOPRIVSNEEDED_MSG,
+                                               Client_ID(Origin),
+                                               Channel_Name(Channel));
+                               break;
                case 'P': /* Persistent channel */
                        if (modeok) {
                                /* Only IRC operators are allowed to