From: Pekka Riikonen Date: Sun, 27 May 2001 17:50:53 +0000 (+0000) Subject: updates. X-Git-Tag: robodoc-323~278 X-Git-Url: http://git.silc.fi/gitweb/?a=commitdiff_plain;h=3e0b4ce691729787b2d98d85c31c3fa464381edb;p=silc.git updates. --- diff --git a/CHANGES b/CHANGES index e10c25ed..2c6d8bcc 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,11 @@ Sun May 27 15:57:17 EEST 2001 Pekka Riikonen * 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 * Fixed the private message sending in the Irssi SILC client, diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index e8386ac5..430da6ae 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -671,6 +671,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, } } break; + } va_end(vp); diff --git a/apps/irssi/src/silc/core/silc-channels.c b/apps/irssi/src/silc/core/silc-channels.c index a522bc4b..c299f65f 100644 --- a/apps/irssi/src/silc/core/silc-channels.c +++ b/apps/irssi/src/silc/core/silc-channels.c @@ -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 { diff --git a/lib/silcclient/client_prvmsg.c b/lib/silcclient/client_prvmsg.c index 53596f81..98ccd699 100644 --- a/lib/silcclient/client_prvmsg.c +++ b/lib/silcclient/client_prvmsg.c @@ -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); + } +} diff --git a/lib/silcclient/silcapi.h b/lib/silcclient/silcapi.h index 0c2b85f0..239078cd 100644 --- a/lib/silcclient/silcapi.h +++ b/lib/silcclient/silcapi.h @@ -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