* 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,
}
}
break;
+
}
va_end(vp);
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 {
{
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);
+ }
+}
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