+Wed Mar 27 00:07:11 EET 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed a bug in the silc_client_nickname_format function that
+ handles the multiple same nickname formatting. Two clients
+ with same nickname caused problems after the first one left
+ and rejoined. It didn't format the nickname correctly.
+ Affected file is lib/silcclient/idlist.c.
+
Tue Mar 26 19:33:03 CET 2002 Pekka Riikonen <priikone@silcnet.org>
* Don't change the topic if olod topic is same as new one.
TODO/bugs In SILC Client Library
================================
- o Three clients, two with same nickname, one nick, other nick@host,
- the nick quits and rejoins channel it becomes nick@host for the third
- client. Both shows nick@host in the third client. This is a bug.
-
o The PRIVATE_MESSAGE_KEY packet is not handled (it is implemented
though). This should be added and perhaps new client operation
should be added to notify application that it was received and
if (domain->hash_size > 2 && domain->hash_tab != NULL)
{
/* Use the hashing table. */
- nls_SilcUInt32 len = strlen (msgid);
- nls_SilcUInt32 hash_val = hash_string (msgid);
- nls_SilcUInt32 idx = hash_val % domain->hash_size;
- nls_SilcUInt32 incr = 1 + (hash_val % (domain->hash_size - 2));
+ nls_uint32 len = strlen (msgid);
+ nls_uint32 hash_val = hash_string (msgid);
+ nls_uint32 idx = hash_val % domain->hash_size;
+ nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
while (1)
{
- nls_SilcUInt32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
+ nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
if (nstr == 0)
/* Hash table entry is empty. */
#endif
#if UINT_MAX == UINT_MAX_32_BITS
-typedef unsigned nls_SilcUInt32;
+typedef unsigned nls_uint32;
#else
# if USHRT_MAX == UINT_MAX_32_BITS
-typedef unsigned short nls_SilcUInt32;
+typedef unsigned short nls_uint32;
# else
# if ULONG_MAX == UINT_MAX_32_BITS
-typedef unsigned long nls_SilcUInt32;
+typedef unsigned long nls_uint32;
# else
/* The following line is intended to throw an error. Using #error is
not portable enough. */
struct mo_file_header
{
/* The magic number. */
- nls_SilcUInt32 magic;
+ nls_uint32 magic;
/* The revision number of the file format. */
- nls_SilcUInt32 revision;
+ nls_uint32 revision;
/* The number of strings pairs. */
- nls_SilcUInt32 nstrings;
+ nls_uint32 nstrings;
/* Offset of table with start offsets of original strings. */
- nls_SilcUInt32 orig_tab_offset;
+ nls_uint32 orig_tab_offset;
/* Offset of table with start offsets of translation strings. */
- nls_SilcUInt32 trans_tab_offset;
+ nls_uint32 trans_tab_offset;
/* Size of hashing table. */
- nls_SilcUInt32 hash_tab_size;
+ nls_uint32 hash_tab_size;
/* Offset of first hashing entry. */
- nls_SilcUInt32 hash_tab_offset;
+ nls_uint32 hash_tab_offset;
};
struct string_desc
{
/* Length of addressed string. */
- nls_SilcUInt32 length;
+ nls_uint32 length;
/* Offset of string in file. */
- nls_SilcUInt32 offset;
+ nls_uint32 offset;
};
/* @@ begin of epilog @@ */
#include "loadinfo.h"
-#include "gettext.h" /* Get nls_SilcUInt32. */
+#include "gettext.h" /* Get nls_uint32. */
/* @@ end of prolog @@ */
# include <byteswap.h>
# define SWAP(i) bswap_32 (i)
#else
-static inline nls_SilcUInt32
+static inline nls_uint32
SWAP (i)
- nls_SilcUInt32 i;
+ nls_uint32 i;
{
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
}
int use_mmap;
size_t mmap_size;
int must_swap;
- nls_SilcUInt32 nstrings;
+ nls_uint32 nstrings;
struct string_desc *orig_tab;
struct string_desc *trans_tab;
- nls_SilcUInt32 hash_size;
- nls_SilcUInt32 *hash_tab;
+ nls_uint32 hash_size;
+ nls_uint32 *hash_tab;
int codeset_cntr;
#ifdef _LIBC
__gconv_t conv;
domain->trans_tab = (struct string_desc *)
((char *) data + W (domain->must_swap, data->trans_tab_offset));
domain->hash_size = W (domain->must_swap, data->hash_tab_size);
- domain->hash_tab = (nls_SilcUInt32 *)
+ domain->hash_tab = (nls_uint32 *)
((char *) data + W (domain->must_swap, data->hash_tab_offset));
break;
default:
char *cp;
char *newnick = NULL;
int i, off = 0, len;
+ bool freebase;
SilcClientEntry *clients;
SilcUInt32 clients_count = 0;
SilcClientEntry unformatted = NULL;
return;
len = 0;
- for (i = 0; i < clients_count; i++)
+ freebase = TRUE;
+ for (i = 0; i < clients_count; i++) {
if (clients[i]->valid && clients[i] != client_entry)
len++;
- if (!len)
+ if (clients[i]->valid && clients[i] != client_entry &&
+ !strcmp(clients[i]->nickname, client_entry->nickname))
+ freebase = FALSE;
+ }
+ if (!len || freebase)
return;
cp = client->internal->params->nickname_format;