SILC_COMMAND_NICK command_reply client operation returns now the
authorPekka Riikonen <priikone@silcnet.org>
Tue, 2 Sep 2003 17:43:39 +0000 (17:43 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 2 Sep 2003 17:43:39 +0000 (17:43 +0000)
old Client ID too.
Fixed some odd GCC "anonymous struct" errors from silcpkcs.h and
silcdlist.h.

apps/irssi/src/silc/core/client_ops.c
apps/irssi/src/silc/core/silc-servers.c
lib/doc/command_reply_args.html
lib/silcclient/command_reply.c
lib/silcclient/idlist.c
lib/silccore/silcid.h
lib/silccrypt/silcpkcs.h
lib/silcutil/silcdlist.h

index dfa69c9887897752fb7c4b949166673c3e2534fc..b8f062aa044182ce490122a562adde5f34a0e2aa 100644 (file)
@@ -1312,9 +1312,9 @@ static void silc_client_join_get_users(SilcClient client,
 
   if (!clients && r->retry < 1) {
     /* Retry to resolve */
+    r->retry++;
     silc_client_get_clients_by_channel(client, conn, channel,
                                       silc_client_join_get_users, context);
-    r->retry++;
     return;
   }
 
index 808941d46de1e884190748850cbd5253608266f8..0287eb772649ac12d94a9766660881d03276f01b 100644 (file)
@@ -181,7 +181,7 @@ void silc_send_mime(SILC_SERVER_REC *server, WI_ITEM_REC *to,
   SILC_CHANNEL_REC *channel;
   QUERY_REC *query;
   char *unescaped_data;
-  int unescaped_data_len;
+  SilcUInt32 unescaped_data_len;
   char *mime_data;
   int mime_data_len;
 
index d6595ae208737a596ef1521e17139cdcb7f94f61..0601489a42d55ab13e05cc5cf87c26d8799697a8 100644 (file)
@@ -126,9 +126,12 @@ this command reply.  The 'name' and 'info' may be NULL.
 <tr>
 <td><small>SILC_COMMAND_NICK</td>
 <td><small>
-Returns the new Client ID after user has changed nickname.
+Returns the new Client ID and new nickname inside the SilcClientEntry.
+The `old_client_id' is the odl Client ID used by the client before the
+nickname was changed.
 </td>
-<td width="50%"><small>SilcClientEntry local_entry, char *nickname
+<td width="50%"><small>SilcClientEntry local_entry, char *nickname,
+const SilcClientID *old_client_id
 </td>
 </tr>
 
index 8807c056b4bbd7e1af846e8cf694e40d831cdc0e..fb90b2707ec5bbc4a882ae527ccf394cfb21427c 100644 (file)
@@ -539,6 +539,7 @@ SILC_CLIENT_CMD_REPLY_FUNC(nick)
   SilcIDPayload idp;
   unsigned char *tmp;
   SilcUInt32 argc, len;
+  SilcClientID old_client_id;
 
   SILC_LOG_DEBUG(("Start"));
 
@@ -558,6 +559,9 @@ SILC_CLIENT_CMD_REPLY_FUNC(nick)
     goto out;
   }
 
+  /* Save old Client ID */
+  old_client_id = *conn->local_id;
+
   /* Take received Client ID */
   tmp = silc_argument_get_arg_type(cmd->args, 2, &len);
   idp = silc_id_payload_parse(tmp, len);
@@ -582,7 +586,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(nick)
   }
 
   /* Notify application */
-  COMMAND_REPLY((SILC_ARGS, conn->local_entry, conn->local_entry->nickname));
+  COMMAND_REPLY((SILC_ARGS, conn->local_entry, conn->local_entry->nickname,
+                (const SilcClientID *)&old_client_id));
 
  out:
   SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_NICK);
index e1c9bc3d6c02a42d3adf6c9e26313846a85661fd..769f64ba10b443d68e0a7750bcc416295139c788 100644 (file)
@@ -887,11 +887,13 @@ bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
   bool ret = silc_idcache_del_by_context(conn->internal->client_cache,
                                         client_entry);
 
-  /* Remove from channels */
-  silc_client_remove_from_channels(client, conn, client_entry);
+  if (ret) {
+    /* Remove from channels */
+    silc_client_remove_from_channels(client, conn, client_entry);
 
-  /* Free the client entry data */
-  silc_client_del_client_entry(client, conn, client_entry);
+    /* Free the client entry data */
+    silc_client_del_client_entry(client, conn, client_entry);
+  }
 
   return ret;
 }
index 9fb5630cf3d2d155f8d488608a84582c301a71c3..741ad9edb8cf9e884ca0fbf7dc74d280c9c10c94 100644 (file)
@@ -422,7 +422,8 @@ typedef struct {
  * DESCRIPTION
  *
  *    Converts an ID of type `type' to data. This can be used to
- *    convert the ID's to data for inclusion in the packets.
+ *    convert the ID's to data for inclusion in the packets.  Use the
+ *    silc_id_get_len to get the length of the ID.
  *
  ***/
 unsigned char *silc_id_id2str(const void *id, SilcIdType type);
index eb1a1f709dca6a7e2c0e26a361ed253a0c542be4..f954542499ebb7261d077db5081cc2ccad0577f1 100644 (file)
@@ -78,7 +78,7 @@ typedef struct SilcPKCSObjectStruct {
  *
  * NAME
  *
- *    typedef struct { ... } *SilcPublicKey;
+ *    typedef struct { ... } *SilcPublicKey, SilcPublicKeyStruct;
  *
  * DESCRIPTION
  *
@@ -98,14 +98,15 @@ typedef struct {
   char *identifier;
   unsigned char *pk;
   SilcUInt32 pk_len;
-} *SilcPublicKey;
+} *SilcPublicKey, SilcPublicKeyStruct;
 /***/
 
 /****s* silccrypt/SilcPKCSAPI/SilcPublicKeyIdentifier
  *
  * NAME
  *
- *    typedef struct { ... } *SilcPublicKeyIdentifier;
+ *    typedef struct { ... } *SilcPublicKeyIdentifier,
+ *                            SilcPublicKeyIdentifierStruct;
  *
  * DESCRIPTION
  *
@@ -124,14 +125,14 @@ typedef struct {
   char *email;
   char *org;
   char *country;
-} *SilcPublicKeyIdentifier;
+} *SilcPublicKeyIdentifier, SilcPublicKeyIdentifierStruct;
 /***/
 
 /****s* silccrypt/SilcPKCSAPI/SilcPrivateKey
  *
  * NAME
  *
- *    typedef struct { ... } *SilcPrivateKey;
+ *    typedef struct { ... } *SilcPrivateKey, SilcPrivateKeyStruct;
  *
  * DESCRIPTION
  *
@@ -145,7 +146,7 @@ typedef struct {
   char *name;
   unsigned char *prv;
   SilcUInt32 prv_len;
-} *SilcPrivateKey;
+} *SilcPrivateKey, SilcPrivateKeyStruct;
 
 /* Public and private key file headers */
 #define SILC_PKCS_PUBLIC_KEYFILE_BEGIN "-----BEGIN SILC PUBLIC KEY-----\n"
index 9eaa0fd268a2ecc5e9bd155d28f560be5abf3773..61371ff63a8c5bd01d2ad8369d2ce4834358d402 100644 (file)
@@ -54,7 +54,7 @@
  *
  * SOURCE
  */
-typedef struct {
+typedef struct SilcDListStruct {
   SilcList list;
 } *SilcDList;
 /***/