]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-mode.c
- Added missing PARAMS().
[ngircd-alex.git] / src / ngircd / irc-mode.c
index c5eeadfb5e87938e29fbb2a6c268529f918c5af1..aac8769512ac87eaf252feecb305ea8303aedf44 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-mode.c,v 1.25 2002/12/26 16:48:14 alex Exp $";
+static char UNUSED id[] = "$Id: irc-mode.c,v 1.28 2003/01/02 17:57:09 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -157,7 +157,11 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
                {
                        case 'a':
                                /* Away */
-                               if( Client_Type( Client ) == CLIENT_SERVER ) x[0] = 'a';
+                               if( Client_Type( Client ) == CLIENT_SERVER )
+                               {
+                                       x[0] = 'a';
+                                       Client_SetAway( Client, DEFAULT_AWAY_MSG );
+                               }
                                else ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
                                break;
                        case 'i':
@@ -392,7 +396,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
                                        {
                                                Channel_ModeDel( Channel, 'k' );
                                                Channel_SetKey( Channel, Req->argv[arg_arg] );
-                                               strcpy( argadd, Channel_Key( Channel ));
+                                               strlcpy( argadd, Channel_Key( Channel ), sizeof( argadd ));
                                                x[0] = *mode_ptr;
                                        }
                                        else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
@@ -418,7 +422,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
                                                {
                                                        Channel_ModeDel( Channel, 'l' );
                                                        Channel_SetMaxUsers( Channel, l );
-                                                       sprintf( argadd, "%ld", l );
+                                                       snprintf( argadd, sizeof( argadd ), "%ld", l );
                                                        x[0] = *mode_ptr;
                                                }
                                        }
@@ -573,13 +577,14 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
        {
                /* AWAY setzen */
                Client_SetAway( Client, Req->argv[0] );
+               Client_ModeAdd( Client, 'a' );
                IRC_WriteStrServersPrefix( Client, Client, "MODE %s :+a", Client_ID( Client ));
                return IRC_WriteStrClient( Client, RPL_NOWAWAY_MSG, Client_ID( Client ));
        }
        else
        {
                /* AWAY loeschen */
-               Client_SetAway( Client, NULL );
+               Client_ModeDel( Client, 'a' );
                IRC_WriteStrServersPrefix( Client, Client, "MODE %s :-a", Client_ID( Client ));
                return IRC_WriteStrClient( Client, RPL_UNAWAY_MSG, Client_ID( Client ));
        }