Commit Diff


commit - b53b5728a607e3315d05da71eddfdbf94b505322
commit + c48501245e730ce2b33547f716d297bb0b805e77
blob - 3ab547630fcd5cc2f34c65a24d70d7bf80f9700c
blob + 07fd6481bb3a55c3f5848bd12294ce0385095075
--- src/ngircd/client.c
+++ src/ngircd/client.c
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: client.c,v 1.38 2002/02/27 14:47:53 alex Exp $
+ * $Id: client.c,v 1.39 2002/02/27 18:22:09 alex Exp $
  *
  * client.c: Management aller Clients
  *
@@ -21,6 +21,9 @@
  * Server gewesen, so existiert eine entsprechende CONNECTION-Struktur.
  *
  * $Log: client.c,v $
+ * Revision 1.39  2002/02/27 18:22:09  alex
+ * - neue Funktion Client_SetAway() und Client_Away() implementiert.
+ *
  * Revision 1.38  2002/02/27 14:47:53  alex
  * - Logging beim Abmelden von Clients (erneut) geaendert: nun ist's aber gut ;-)
  *
@@ -447,6 +450,29 @@ GLOBAL VOID Client_SetPassword( CLIENT *Client, CHAR *
 	strncpy( Client->pwd, Pwd, CLIENT_PASS_LEN );
 	Client->pwd[CLIENT_PASS_LEN - 1] = '\0';
 } /* Client_SetPassword */
+
+
+GLOBAL VOID Client_SetAway( CLIENT *Client, CHAR *Txt )
+{
+	/* Von einem Client gelieferte AWAY-Nachricht */
+
+	assert( Client != NULL );
+
+	if( Txt )
+	{
+		/* Client AWAY setzen */
+		strncpy( Client->away, Txt, CLIENT_AWAY_LEN );
+		Client->away[CLIENT_AWAY_LEN - 1] = '\0';
+		Client_ModeAdd( Client, 'a' );
+		Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
+	}
+	else
+	{
+		/* AWAY loeschen */
+		Client_ModeDel( Client, 'a' );
+		Log( LOG_DEBUG, "User \"%s\" is no longer away.", Client_Mask( Client ));
+	}
+} /* Client_SetAway */
 
 
 GLOBAL VOID Client_SetType( CLIENT *Client, INT Type )
@@ -729,6 +755,15 @@ GLOBAL BOOLEAN Client_HasMode( CLIENT *Client, CHAR Mo
 	assert( Client != NULL );
 	return strchr( Client->modes, Mode ) != NULL;
 } /* Client_HasMode */
+
+
+GLOBAL CHAR *Client_Away( CLIENT *Client )
+{
+	/* AWAY-Text liefern */
+
+	assert( Client != NULL );
+	return Client->away;
+} /* Client_Away */
 
 
 GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick )
@@ -978,6 +1013,7 @@ LOCAL CLIENT *New_Client_Struct( VOID )
 	c->hops = -1;
 	c->token = -1;
 	c->mytoken = -1;
+	strcpy( c->away, "" );
 
 	return c;
 } /* New_Client */
blob - 30cd17ac2be7e7a4a8316665b46ac9b9fe0dc9b0
blob + 3edc10c334a19325ff029cd52d2ca02f474cf974
--- src/ngircd/client.h
+++ src/ngircd/client.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: client.h,v 1.22 2002/02/06 16:49:56 alex Exp $
+ * $Id: client.h,v 1.23 2002/02/27 18:22:09 alex Exp $
  *
  * client.h: Konfiguration des ngircd (Header)
  *
  * $Log: client.h,v $
+ * Revision 1.23  2002/02/27 18:22:09  alex
+ * - neue Funktion Client_SetAway() und Client_Away() implementiert.
+ *
  * Revision 1.22  2002/02/06 16:49:56  alex
  * - neue Funktion Client_IsValidNick().
  *
@@ -125,6 +128,7 @@ typedef struct _CLIENT
 	CHAR modes[CLIENT_MODE_LEN];	/* Client Modes */
 	INT hops, token, mytoken;	/* "Hops" und "Token" (-> SERVER-Befehl) */
 	BOOLEAN oper_by_me;		/* IRC-Operator-Status durch diesen Server? */
+	CHAR away[CLIENT_AWAY_LEN];	/* AWAY-Text, wenn Mode 'a' gesetzt */
 } CLIENT;
 #else
 typedef POINTER CLIENT;
@@ -167,6 +171,7 @@ GLOBAL INT Client_Token( CLIENT *Client );
 GLOBAL INT Client_MyToken( CLIENT *Client );
 GLOBAL CLIENT *Client_TopServer( CLIENT *Client );
 GLOBAL CLIENT *Client_NextHop( CLIENT *Client );
+GLOBAL CHAR *Client_Away( CLIENT *Client );
 
 GLOBAL BOOLEAN Client_HasMode( CLIENT *Client, CHAR Mode );
 
@@ -181,6 +186,7 @@ GLOBAL VOID Client_SetToken( CLIENT *Client, INT Token
 GLOBAL VOID Client_SetOperByMe( CLIENT *Client, BOOLEAN OperByMe );
 GLOBAL VOID Client_SetModes( CLIENT *Client, CHAR *Modes );
 GLOBAL VOID Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer );
+GLOBAL VOID Client_SetAway( CLIENT *Client, CHAR *Txt );
 
 GLOBAL BOOLEAN Client_ModeAdd( CLIENT *Client, CHAR Mode );
 GLOBAL BOOLEAN Client_ModeDel( CLIENT *Client, CHAR Mode );