Applied fixed from cras to fix crashes in irssi.
authorPekka Riikonen <priikone@silcnet.org>
Fri, 12 Apr 2002 21:14:42 +0000 (21:14 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Fri, 12 Apr 2002 21:14:42 +0000 (21:14 +0000)
apps/irssi/src/fe-common/core/fe-exec.c
apps/irssi/src/fe-common/core/fe-exec.h
apps/irssi/src/fe-common/core/fe-windows.c
doc/draft-riikonen-silc-spec-05.nroff
lib/silcutil/silcbuffer.h
lib/silcutil/silcstrutil.h

index 809726341d4fc99983cc223601b7f25de0b1c463..033e6be616499ef016b5cfa52815aae7058f1990 100644 (file)
@@ -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 <nick> */
                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);
index bebd1f82cf6384c0835797a391dad11487e1025a..a3b7edee1defb5a5fc61abacb0d8a01e887a0b18 100644 (file)
@@ -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;
index 38dd22fec2a174904f59febf8a20b7dafefc2eb1..2370facb239552247a1f1c926c627935141bc0ea 100644 (file)
@@ -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);
 }
index f039a94d66230fc80870adf5049936ee7f1cf99b..d98a3ff5fa2706ccf3554f7e2ebea76bf07c89b1 100644 (file)
@@ -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 = <major>[.<minor>[.<build or vendor string>]]
 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-<software version>.  If new protocol version 
-causes in compatibilities with older version the the <minor> versio number 
+causes incompatibilities with older version the <minor> version number 
 MUST be incremented.  The <major> is incremented if new protocol version 
 is fully incompatible.
 
index b495296e613240dfeefec9282789a15ab2ab7743..e0214337d7b8322b937d921d89d8ed358f5df2e4 100644 (file)
@@ -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);
   }
index 746d0ad9cafd51a56a0961e60744b94c3a4eaa02..868fdc8c9ad8866feb92970e6b8f1cb75101daec 100644 (file)
@@ -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