updates.
authorPekka Riikonen <priikone@silcnet.org>
Sun, 27 May 2001 17:50:53 +0000 (17:50 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 27 May 2001 17:50:53 +0000 (17:50 +0000)
CHANGES
apps/irssi/src/silc/core/client_ops.c
apps/irssi/src/silc/core/silc-channels.c
lib/silcclient/client_prvmsg.c
lib/silcclient/silcapi.h

diff --git a/CHANGES b/CHANGES
index e10c25ed05a6479c1a120b27ee8f479cfcba4e1f..2c6d8bccbe5083eebcffb53b9a220e42e57430c6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,11 @@ Sun May 27 15:57:17 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
        * Added invite list, ban list, some key management and connection
          error message printing to module formats in the Irssi SILC client.
 
+       * Added new silc_client_set_away_message to set the away message
+         that is back to the person who sent private message.  The 
+         affected file lib/silcclient/silcapi.h and the
+         lib/silcclient/client_prvmsg.c.
+
 Sun May 27 12:39:48 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
        * Fixed the private message sending in the Irssi SILC client,
index e8386ac52055329107581b5fd1db608119811881..430da6ae11761a76525059d626462a54cf1bd2b7 100644 (file)
@@ -671,6 +671,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
       }
     }
     break;
+
   }
 
   va_end(vp);
index a522bc4b7dc144fee37de5db0e1ec019a448f7f7..c299f65f928c053fe0e64c7c83d46e64aafdf4a7 100644 (file)
@@ -539,10 +539,22 @@ static void command_notice(const char *data, SILC_SERVER_REC *server,
 static void command_away(const char *data, SILC_SERVER_REC *server,
                         WI_ITEM_REC *item)
 {
+  bool set;
+
   if (!IS_SILC_SERVER(server) || !server->connected)
     cmd_return_error(CMDERR_NOT_CONNECTED);
 
-  /* XXX TODO */
+  if (*data == '\0') {
+    /* Remove any possible away message */
+    silc_client_set_away_message(silc_client, server->conn, NULL);
+    set = FALSE;
+  } else {
+    /* Set the away message */
+    silc_client_set_away_message(silc_client, server->conn, (char *)data);
+    set = TRUE;
+  }
+
+  silc_command_exec(server, "UMODE", set ? "+g" : "-g");
 }
 
 typedef struct {
index 53596f81cd73022601c6b047fa3f6d0959aa35aa..98ccd69954258a499fbbfbfacd76b6d4c066dafc 100644 (file)
@@ -525,3 +525,30 @@ void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
 {
   silc_free(keys);
 }
+
+/* Sets away `message'.  The away message may be set when the client's
+   mode is changed to SILC_UMODE_GONE and the client whishes to reply
+   to anyone who sends private message.  The `message' will be sent
+   automatically back to the the client who send private message.  If
+   away message is already set this replaces the old message with the
+   new one.  If `message' is NULL the old away message is removed. 
+   The sender may freely free the memory of the `message'. */
+
+void silc_client_set_away_message(SilcClient client,
+                                 SilcClientConnection conn,
+                                 char *message)
+{
+  if (!message && conn->away) {
+    silc_free(conn->away->away);
+    silc_free(conn->away);
+    conn->away = NULL;
+  }
+
+  if (message) {
+    if (!conn->away)
+      conn->away = silc_calloc(1, sizeof(*conn->away));
+    if (conn->away->away)
+      silc_free(conn->away->away);
+    conn->away->away = strdup(message);
+  }
+}
index 0c2b85f0fcadba79677928ece5c7ce7bb5d2975b..239078cdbfab6bea37db0d2abc4b9642f072f911 100644 (file)
@@ -702,4 +702,19 @@ void silc_client_abort_key_agreement(SilcClient client,
                                     SilcClientConnection conn,
                                     SilcClientEntry client_entry);
 
+
+/* Misc functions */
+
+/* Sets away `message'.  The away message may be set when the client's
+   mode is changed to SILC_UMODE_GONE and the client whishes to reply
+   to anyone who sends private message.  The `message' will be sent
+   automatically back to the the client who send private message.  If
+   away message is already set this replaces the old message with the
+   new one.  If `message' is NULL the old away message is removed. 
+   The sender may freely free the memory of the `message'. */
+
+void silc_client_set_away_message(SilcClient client,
+                                 SilcClientConnection conn,
+                                 char *message);
+
 #endif