From: Pekka Riikonen Date: Fri, 12 Apr 2002 21:14:42 +0000 (+0000) Subject: Applied fixed from cras to fix crashes in irssi. X-Git-Tag: silc.client.0.8.6~4^2 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=59b463deda7f532fe4ec669f9694330e0deaeef8 Applied fixed from cras to fix crashes in irssi. --- diff --git a/apps/irssi/src/fe-common/core/fe-exec.c b/apps/irssi/src/fe-common/core/fe-exec.c index 80972634..033e6be6 100644 --- a/apps/irssi/src/fe-common/core/fe-exec.c +++ b/apps/irssi/src/fe-common/core/fe-exec.c @@ -28,6 +28,9 @@ #include "misc.h" #include "levels.h" +#include "channels.h" +#include "queries.h" + #include "printtext.h" #include "fe-exec.h" #include "fe-windows.h" @@ -370,7 +373,7 @@ static void handle_exec(const char *args, GHashTable *optlist, { PROCESS_REC *rec; char *target, *level; - int notice, signum, interactive; + int notice, signum, interactive, target_nick, target_channel; /* check that there's no unknown options. we allowed them because signals can be used as options, but there should be @@ -403,11 +406,14 @@ static void handle_exec(const char *args, GHashTable *optlist, return; /* common options */ + target_channel = target_nick = FALSE; if (g_hash_table_lookup(optlist, "out") != NULL) { /* redirect output to active channel/query */ if (item == NULL) cmd_return_error(CMDERR_NOT_JOINED); - target = item->name; + target = item->name; + target_channel = IS_CHANNEL(item); + target_nick = IS_QUERY(item); } else if (g_hash_table_lookup(optlist, "msg") != NULL) { /* redirect output to /msg */ target = g_hash_table_lookup(optlist, "msg"); @@ -487,6 +493,8 @@ static void handle_exec(const char *args, GHashTable *optlist, rec->id = process_get_new_id(); rec->target = g_strdup(target); rec->target_win = active_win; + rec->target_channel = target_channel; + rec->target_nick = target_nick; rec->args = g_strdup(args); rec->notice = notice; rec->silent = g_hash_table_lookup(optlist, "-") != NULL; @@ -572,7 +580,9 @@ static void sig_exec_input(PROCESS_REC *rec, const char *text) server = item != NULL ? item->server : active_win->active_server; - str = g_strconcat(rec->target, " ", text, NULL); + str = g_strconcat(rec->target_nick ? "-nick " : + rec->target_channel ? "-channel " : "", + rec->target, " ", text, NULL); signal_emit(rec->notice ? "command notice" : "command msg", 3, str, server, item); g_free(str); diff --git a/apps/irssi/src/fe-common/core/fe-exec.h b/apps/irssi/src/fe-common/core/fe-exec.h index bebd1f82..a3b7edee 100644 --- a/apps/irssi/src/fe-common/core/fe-exec.h +++ b/apps/irssi/src/fe-common/core/fe-exec.h @@ -38,6 +38,8 @@ struct PROCESS_REC { unsigned int shell:1; /* start the program via /bin/sh */ unsigned int notice:1; /* send text with /notice, not /msg if target is set */ unsigned int silent:1; /* don't print "process exited with level xx" */ + unsigned int target_channel:1; /* target is a channel */ + unsigned int target_nick:1; /* target is a nick */ }; extern GSList *processes; diff --git a/apps/irssi/src/fe-common/core/fe-windows.c b/apps/irssi/src/fe-common/core/fe-windows.c index 38dd22fe..2370facb 100644 --- a/apps/irssi/src/fe-common/core/fe-windows.c +++ b/apps/irssi/src/fe-common/core/fe-windows.c @@ -160,6 +160,9 @@ void window_set_active(WINDOW_REC *window) void window_change_server(WINDOW_REC *window, void *server) { + if (server != NULL && SERVER(server)->disconnected) + return; + window->active_server = server; signal_emit("window server changed", 2, window, server); } diff --git a/doc/draft-riikonen-silc-spec-05.nroff b/doc/draft-riikonen-silc-spec-05.nroff index f039a94d..d98a3ff5 100644 --- a/doc/draft-riikonen-silc-spec-05.nroff +++ b/doc/draft-riikonen-silc-spec-05.nroff @@ -883,7 +883,7 @@ established by the SILC Key Exchange Protocol, described in [SILC3]. Every packet sent from client to server, with exception of packets for channels, are encrypted with this session key. -Channels has their own key that are shared by every client on the channel. +Channels has a channel key that are shared by every client on the channel. However, the channel keys are cell specific thus one cell does not know the channel key of the other cell, even if that key is for same channel. Channel key is also known by the routers and all servers that has clients @@ -966,9 +966,10 @@ Example: Private message from client to another client on different message delivery key with each other and that is used in the message encryption. -o Client 1. sends encrypted packet to its server. The packet is - encrypted with the private message delivery key shared between - clients. +o Client 1. sends encrypted packet to its server. The packet header + is encrypted with the session key shared between the client and + server, and the private message is encrypted with the private + message delivery key shared between clients. o Server determines the destination of the packet and sends the packet to the router. @@ -1093,10 +1094,10 @@ Figure 5: Authentication Payload .in 6 o Payload Length (2 bytes) - Length of the entire payload. -o Authentication Method (2) - The method of the authentication. - The authentication methods are defined in [SILC2] in the - Connection Auth Request Payload. The NONE authentication - method SHOULD NOT be used. +o Authentication Method (2 bytes) - The method of the + authentication. The authentication methods are defined + in [SILC2] in the Connection Auth Request Payload. The NONE + authentication method SHOULD NOT be used. o Public Data Length (2 bytes) - Indicates the length of the Public Data field. @@ -1425,7 +1426,7 @@ software version = [.[.]] Protocol version MAY provide both major and minor version. Currently implementations MUST set the protocol version and accept at least the protocol version as SILC-1.1-. If new protocol version -causes in compatibilities with older version the the versio number +causes incompatibilities with older version the version number MUST be incremented. The is incremented if new protocol version is fully incompatible. diff --git a/lib/silcutil/silcbuffer.h b/lib/silcutil/silcbuffer.h index b495296e..e0214337 100644 --- a/lib/silcutil/silcbuffer.h +++ b/lib/silcutil/silcbuffer.h @@ -157,7 +157,9 @@ static inline void silc_buffer_free(SilcBuffer sb) { if (sb) { +#ifdef SILC_DEBUG memset(sb->head, 'F', sb->truelen); +#endif silc_free(sb->head); silc_free(sb); } diff --git a/lib/silcutil/silcstrutil.h b/lib/silcutil/silcstrutil.h index 746d0ad9..868fdc8c 100644 --- a/lib/silcutil/silcstrutil.h +++ b/lib/silcutil/silcstrutil.h @@ -82,7 +82,7 @@ unsigned char *silc_pem_decode(unsigned char *pem, SilcUInt32 pem_len, * * DESCRIPTION * - * String encoding definitions used with the UTF-8 encoding and the + * String encoding definitions used with the UTF-8 encoding and * decoding functions. * * SOURCE