Commit Diff


commit - 83177581e476a5f18120b9323910ddf2f24b9d3e
commit + 949977e8786aa804f3c6a64c07c34cc92375cf17
blob - 5288a8ce7f9b81455542cff80da962b276a06bbb
blob + 7296f83f1001ac7335f81705f00e37e7a53a9b2b
--- src/ngircd/irc.c
+++ src/ngircd/irc.c
@@ -9,11 +9,14 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: irc.c,v 1.77 2002/02/27 17:05:41 alex Exp $
+ * $Id: irc.c,v 1.78 2002/02/27 18:23:45 alex Exp $
  *
  * irc.c: IRC-Befehle
  *
  * $Log: irc.c,v $
+ * Revision 1.78  2002/02/27 18:23:45  alex
+ * - IRC-Befehl "AWAY" implementert.
+ *
  * Revision 1.77  2002/02/27 17:05:41  alex
  * - PRIVMSG beachtet nun die Channel-Modes "n" und "m".
  *
@@ -1382,6 +1385,14 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req 
 			/* Befehl kommt von einem Server, daher
 			 * trauen wir ihm "unbesehen" ... */
 			x[0] = *mode_ptr;
+
+			if(( cl ) && ( x[0] == 'a' ))
+			{
+				/* away */
+				if( set ) Client_SetAway( cl, "Away" );
+				else Client_SetAway( cl, NULL );
+			}
+			
 		}
 		else
 		{
@@ -1467,7 +1478,7 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req 
 							x[0] = 'p';
 							break;
 						case 'q':
-							/* Quite */
+							/* Quiet */
 							x[0] = 'q';
 							break;
 						case 's':
@@ -1603,7 +1614,34 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req 
 
 	return ok;
 } /* IRC_MODE */
+
+
+GLOBAL BOOLEAN IRC_AWAY( CLIENT *Client, REQUEST *Req )
+{
+	assert( Client != NULL );
+	assert( Req != NULL );
+
+	if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
+
+	/* Falsche Anzahl Parameter? */
+	if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
 
+	if(( Req->argc == 1 ) && (Req->argv[0][0] ))
+	{
+		/* AWAY setzen */
+		Client_SetAway( Client, Req->argv[0] );
+		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 );
+		IRC_WriteStrServersPrefix( Client, Client, "MODE %s :-a", Client_ID( Client ));
+		return IRC_WriteStrClient( Client, RPL_UNAWAY_MSG, Client_ID( Client ));
+	}
+} /* IRC_AWAY */
+
 
 GLOBAL BOOLEAN IRC_OPER( CLIENT *Client, REQUEST *Req )
 {
@@ -1905,6 +1943,12 @@ GLOBAL BOOLEAN IRC_WHOIS( CLIENT *Client, REQUEST *Req
 		if( ! IRC_WriteStrClient( from, RPL_WHOISIDLE_MSG, Client_ID( from ), Client_ID( c ), Conn_GetIdle( Client_Conn ( c )))) return DISCONNECTED;
 	}
 
+	/* Away? */
+	if( Client_HasMode( c, 'a' ))
+	{
+		if( ! IRC_WriteStrClient( from, RPL_AWAY_MSG, Client_ID( from ), Client_ID( c ), Client_Away( c ))) return DISCONNECTED;
+	}
+
 	/* End of Whois */
 	return IRC_WriteStrClient( from, RPL_ENDOFWHOIS_MSG, Client_ID( from ), Client_ID( c ));
 } /* IRC_WHOIS */
blob - e796038f74fc147effcd4fe4e452541b512aa895
blob + ac30318de3cee1e8cd533b41082fee0828fb306c
--- src/ngircd/irc.h
+++ src/ngircd/irc.h
@@ -9,11 +9,14 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: irc.h,v 1.24 2002/02/23 21:39:48 alex Exp $
+ * $Id: irc.h,v 1.25 2002/02/27 18:23:46 alex Exp $
  *
  * irc.h: IRC-Befehle (Header)
  *
  * $Log: irc.h,v $
+ * Revision 1.25  2002/02/27 18:23:46  alex
+ * - IRC-Befehl "AWAY" implementert.
+ *
  * Revision 1.24  2002/02/23 21:39:48  alex
  * - IRC-Befehl KILL sowie Kills bei Nick Collsisions implementiert.
  *
@@ -134,6 +137,7 @@ GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *R
 GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req );
 
 GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req );
+GLOBAL BOOLEAN IRC_AWAY( CLIENT *Client, REQUEST *Req );
 
 GLOBAL BOOLEAN IRC_NAMES( CLIENT *Client, REQUEST *Req );
 GLOBAL BOOLEAN IRC_ISON( CLIENT *Client, REQUEST *Req );
blob - 89438bc18e65cbd7001c6937cb276c9d79817055
blob + 4f5eb66243474e722c7e558c8df436ce1f93d6c2
--- src/ngircd/parse.c
+++ src/ngircd/parse.c
@@ -9,11 +9,14 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: parse.c,v 1.25 2002/02/26 20:52:15 alex Exp $
+ * $Id: parse.c,v 1.26 2002/02/27 18:23:46 alex Exp $
  *
  * parse.c: Parsen der Client-Anfragen
  *
  * $Log: parse.c,v $
+ * Revision 1.26  2002/02/27 18:23:46  alex
+ * - IRC-Befehl "AWAY" implementert.
+ *
  * Revision 1.25  2002/02/26 20:52:15  alex
  * - Fehler bei Fehlermeldung wg. unbekanntem Prefix behoben.
  *
@@ -378,6 +381,7 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Re
 	else if( strcasecmp( Req->command, "PART" ) == 0 ) return IRC_PART( client, Req );
 	else if( strcasecmp( Req->command, "VERSION" ) == 0 ) return IRC_VERSION( client, Req );
 	else if( strcasecmp( Req->command, "KILL" ) == 0 ) return IRC_KILL( client, Req );
+	else if( strcasecmp( Req->command, "AWAY" ) == 0 ) return IRC_AWAY( client, Req );
 	
 	/* Unbekannter Befehl */
 	if( Client_Type( client ) != CLIENT_SERVER ) IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );