+Wed Dec 31 17:06:55 CET 2003 Jochen Eisinger <jochen@penguin-breeder.org>
+
+ * Don't use silc_get_input, it's obviously not reliable. Fixes
+ issue when the current key expires. Affect file
+ irssi/src/silc/core/clientutils.c
+
+ * Make the session data filename configurable. This makes it
+ possible to have different session files for different
+ SILC networks. Affected files irssi/src/silc/core/silc-core.c,
+ client_ops.[ch], silc-servers.c,
+ irssi/src/silc/fe-common/silc/module-formats.[ch]
+
Sun Dec 28 21:57:39 EET 2003 Pekka Riikonen <priikone@silcnet.org>
* Fixed server statistics decrementing error to not go to
{ "watch_nick_change", "Watch: {nick $0} changed nickname to {nick $1}", 2, { 0, 0 } },
{ "message_data", "{nick $0} sent \"{hilight $1}\" data message: cannot display", 2, { 0, 0 } },
{ "stats", "$[25]0: {hilight $1}", 2, { 0, 0 } },
+ { "reattach", "Resuming old session on {hilight $0}, may take a while ...", 1, { 0 } },
/* File transfer messages */
{ NULL, "FileTransfer", 0 },
SILCTXT_WATCH_NICK_CHANGE,
SILCTXT_MESSAGE_DATA,
SILCTXT_STATS,
+ SILCTXT_REATTACH,
SILCTXT_FILL_5,
#include "levels.h"
#include "settings.h"
#include "ignore.h"
+#include "special-vars.h"
#include "fe-common/core/printtext.h"
#include "fe-common/core/fe-channels.h"
#include "fe-common/core/keyboard.h"
SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context);
+char *silc_get_session_filename(SILC_SERVER_REC *server)
+{
+ char *file, *expanded;
+
+ expanded = parse_special_string(settings_get_str("session_filename"),
+ SERVER(server), NULL, "", NULL, 0);
+
+ file = silc_calloc(1, strlen(expanded) + 255);
+ snprintf(file, strlen(expanded) + 255, "%s/%s", get_irssi_dir(), expanded);
+ free(expanded);
+
+ return file;
+}
+
static void silc_get_umode_string(SilcUInt32 mode, char *buf,
SilcUInt32 buf_size)
{
signal_emit("message own_nick", 4, server, server->nick, old, "");
g_free(old);
}
+
+ /* remove the detach data now */
+ {
+ char *file;
+
+ file = silc_get_session_filename(server);
+
+ unlink(file);
+ silc_free(file);
+ }
break;
default:
silc_detach(SilcClient client, SilcClientConnection conn,
const unsigned char *detach_data, SilcUInt32 detach_data_len)
{
- char file[256];
+ SILC_SERVER_REC *server = conn->context;
+ char *file;
/* Save the detachment data to file. */
- memset(file, 0, sizeof(file));
- snprintf(file, sizeof(file) - 1, "%s/session", get_irssi_dir());
+ file = silc_get_session_filename(server);
silc_file_writefile(file, detach_data, detach_data_len);
+ silc_free(file);
}
#ifndef CLIENT_OPS_H
#define CLIENT_OPS_H
+#include "silc-servers.h"
+
void silc_say(SilcClient client, SilcClientConnection conn,
SilcClientMessageType type, char *msg, ...);
void silc_say_error(char *msg, ...);
char *
silc_escape_data(const char *data, SilcUInt32 len);
+char *
+silc_get_session_filename(SILC_SERVER_REC *server);
+
#endif
settings_add_int("server", "connauth_request_secs", 2);
settings_add_int("server", "heartbeat", 300);
settings_add_bool("server", "ignore_message_signatures", FALSE);
+ settings_add_str("server", "session_filename", "session.$chatnet");
/* Requested Attributes settings */
settings_add_bool("silc", "attr_allow", TRUE);
#include "servers-setup.h"
+#include "client_ops.h"
#include "silc-servers.h"
#include "silc-channels.h"
#include "silc-queries.h"
{
SilcClientConnection conn;
SilcClientConnectionParams params;
- char file[256];
+ char *file;
int fd;
if (!IS_SILC_SERVER(server))
/* Try to read detached session data and use it if found. */
memset(¶ms, 0, sizeof(params));
- memset(file, 0, sizeof(file));
- snprintf(file, sizeof(file) - 1, "%s/session", get_irssi_dir());
+ file = silc_get_session_filename(server);
params.detach_data = silc_file_readfile(file, ¶ms.detach_data_len);
if (params.detach_data)
params.detach_data[params.detach_data_len] = 0;
server->conn = conn;
if (params.detach_data)
- keyboard_entry_redirect(NULL,
- "-- Resuming old session, may take a while ...",
- ENTRY_REDIRECT_FLAG_HIDDEN, server);
+ printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP,
+ SILCTXT_REATTACH, server->tag);
silc_free(params.detach_data);
- unlink(file);
fd = g_io_channel_unix_get_fd(net_sendbuffer_handle(server->handle));