From: Pekka Riikonen Date: Tue, 2 Sep 2003 17:43:39 +0000 (+0000) Subject: SILC_COMMAND_NICK command_reply client operation returns now the X-Git-Tag: silc.toolkit.0.9.10~40 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=e4fd5debfe18a3aa692891dfa5b49b84801b3e46;p=silc.git SILC_COMMAND_NICK command_reply client operation returns now the old Client ID too. Fixed some odd GCC "anonymous struct" errors from silcpkcs.h and silcdlist.h. --- diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index dfa69c98..b8f062aa 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -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; } diff --git a/apps/irssi/src/silc/core/silc-servers.c b/apps/irssi/src/silc/core/silc-servers.c index 808941d4..0287eb77 100644 --- a/apps/irssi/src/silc/core/silc-servers.c +++ b/apps/irssi/src/silc/core/silc-servers.c @@ -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; diff --git a/lib/doc/command_reply_args.html b/lib/doc/command_reply_args.html index d6595ae2..0601489a 100644 --- a/lib/doc/command_reply_args.html +++ b/lib/doc/command_reply_args.html @@ -126,9 +126,12 @@ this command reply. The 'name' and 'info' may be NULL. SILC_COMMAND_NICK -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. -SilcClientEntry local_entry, char *nickname +SilcClientEntry local_entry, char *nickname, +const SilcClientID *old_client_id diff --git a/lib/silcclient/command_reply.c b/lib/silcclient/command_reply.c index 8807c056..fb90b270 100644 --- a/lib/silcclient/command_reply.c +++ b/lib/silcclient/command_reply.c @@ -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); diff --git a/lib/silcclient/idlist.c b/lib/silcclient/idlist.c index e1c9bc3d..769f64ba 100644 --- a/lib/silcclient/idlist.c +++ b/lib/silcclient/idlist.c @@ -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; } diff --git a/lib/silccore/silcid.h b/lib/silccore/silcid.h index 9fb5630c..741ad9ed 100644 --- a/lib/silccore/silcid.h +++ b/lib/silccore/silcid.h @@ -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); diff --git a/lib/silccrypt/silcpkcs.h b/lib/silccrypt/silcpkcs.h index eb1a1f70..f9545424 100644 --- a/lib/silccrypt/silcpkcs.h +++ b/lib/silccrypt/silcpkcs.h @@ -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" diff --git a/lib/silcutil/silcdlist.h b/lib/silcutil/silcdlist.h index 9eaa0fd2..61371ff6 100644 --- a/lib/silcutil/silcdlist.h +++ b/lib/silcutil/silcdlist.h @@ -54,7 +54,7 @@ * * SOURCE */ -typedef struct { +typedef struct SilcDListStruct { SilcList list; } *SilcDList; /***/