Wed Nov 1 17:21:26 EET 2000 Pekka Riikonen <priikone@poseidon.pspt.fi>
+ * NAMES command reply now shows users mode with the nickname when
+ joining to channel.
+
+ * Moved silc_client_ch[u]mode[_char] functions from
+ silc/clientutil.[ch] to lib/silcclient/client.[ch]. Though, that
+ place sucks, they are utility functions and should be in some
+ other file.
+
* Fixed some unsigned int's to unsigned short's. Patch by cras.
* Fixed contrib/getopt*.[ch] to not require config.h. Patch by
return TRUE;
}
-
-/* Parses mode mask and returns the mode as string. */
-
-char *silc_client_chmode(unsigned int mode)
-{
- char string[20];
-
- if (!mode)
- return NULL;
-
- memset(string, 0, sizeof(string));
-
- if (mode & SILC_CHANNEL_MODE_PRIVATE)
- strncat(string, "p", 1);
-
- if (mode & SILC_CHANNEL_MODE_SECRET)
- strncat(string, "s", 1);
-
- if (mode & SILC_CHANNEL_MODE_PRIVKEY)
- strncat(string, "k", 1);
-
- if (mode & SILC_CHANNEL_MODE_INVITE)
- strncat(string, "i", 1);
-
- if (mode & SILC_CHANNEL_MODE_TOPIC)
- strncat(string, "t", 1);
-
- if (mode & SILC_CHANNEL_MODE_ULIMIT)
- strncat(string, "l", 1);
-
- if (mode & SILC_CHANNEL_MODE_PASSPHRASE)
- strncat(string, "a", 1);
-
- /* Rest of mode is ignored */
-
- return strdup(string);
-}
-
-/* Parses channel user mode mask and returns te mode as string */
-
-char *silc_client_chumode(unsigned int mode)
-{
- char string[4];
-
- if (!mode)
- return NULL;
-
- memset(string, 0, sizeof(string));
-
- if (mode & SILC_CHANNEL_UMODE_CHANFO)
- strncat(string, "f", 1);
-
- if (mode & SILC_CHANNEL_UMODE_CHANOP)
- strncat(string, "o", 1);
-
- return strdup(string);
-}
-
-/* Parses channel user mode and returns it as special mode character. */
-
-char *silc_client_chumode_char(unsigned int mode)
-{
- char string[4];
-
- if (!mode)
- return NULL;
-
- memset(string, 0, sizeof(string));
-
- if (mode & SILC_CHANNEL_UMODE_CHANFO)
- strncat(string, "*", 1);
-
- if (mode & SILC_CHANNEL_UMODE_CHANOP)
- strncat(string, "@", 1);
-
- return strdup(string);
-}
SilcPrivateKey *ret_prv_key);
int silc_client_check_silc_dir();
int silc_client_load_keys(SilcClient client);
-char *silc_client_chmode(unsigned int mode);
-char *silc_client_chumode(unsigned int mode);
-char *silc_client_chumode_char(unsigned int mode);
#endif
silc_idcache_list_free(list);
}
+
+/* Parses mode mask and returns the mode as string. */
+
+char *silc_client_chmode(unsigned int mode)
+{
+ char string[20];
+
+ if (!mode)
+ return NULL;
+
+ memset(string, 0, sizeof(string));
+
+ if (mode & SILC_CHANNEL_MODE_PRIVATE)
+ strncat(string, "p", 1);
+
+ if (mode & SILC_CHANNEL_MODE_SECRET)
+ strncat(string, "s", 1);
+
+ if (mode & SILC_CHANNEL_MODE_PRIVKEY)
+ strncat(string, "k", 1);
+
+ if (mode & SILC_CHANNEL_MODE_INVITE)
+ strncat(string, "i", 1);
+
+ if (mode & SILC_CHANNEL_MODE_TOPIC)
+ strncat(string, "t", 1);
+
+ if (mode & SILC_CHANNEL_MODE_ULIMIT)
+ strncat(string, "l", 1);
+
+ if (mode & SILC_CHANNEL_MODE_PASSPHRASE)
+ strncat(string, "a", 1);
+
+ /* Rest of mode is ignored */
+
+ return strdup(string);
+}
+
+/* Parses channel user mode mask and returns te mode as string */
+
+char *silc_client_chumode(unsigned int mode)
+{
+ char string[4];
+
+ if (!mode)
+ return NULL;
+
+ memset(string, 0, sizeof(string));
+
+ if (mode & SILC_CHANNEL_UMODE_CHANFO)
+ strncat(string, "f", 1);
+
+ if (mode & SILC_CHANNEL_UMODE_CHANOP)
+ strncat(string, "o", 1);
+
+ return strdup(string);
+}
+
+/* Parses channel user mode and returns it as special mode character. */
+
+char *silc_client_chumode_char(unsigned int mode)
+{
+ char string[4];
+
+ if (!mode)
+ return NULL;
+
+ memset(string, 0, sizeof(string));
+
+ if (mode & SILC_CHANNEL_UMODE_CHANFO)
+ strncat(string, "*", 1);
+
+ if (mode & SILC_CHANNEL_UMODE_CHANOP)
+ strncat(string, "@", 1);
+
+ return strdup(string);
+}
SilcClientConnection conn,
SilcClientEntry old,
SilcClientEntry new);
+char *silc_client_chmode(unsigned int mode);
+char *silc_client_chumode(unsigned int mode);
+char *silc_client_chumode_char(unsigned int mode);
+
#endif
channel->clients[k].client->nickname =
silc_calloc(strlen(nickname) + 8, sizeof(*channel->clients[k].
client->nickname));
+ snprintf(t, sizeof(t), "[%d]", c++);
+ strncat(channel->clients[k].client->nickname, t, strlen(t));
strncat(channel->clients[k].client->nickname, nickname,
strlen(nickname));
- snprintf(t, sizeof(t), " [%d]", c++);
- strncat(channel->clients[k].client->nickname, t, strlen(t));
}
}
name_list = NULL;
len1 = 0;
for (k = 0; k < channel->clients_count; k++) {
- char *n = channel->clients[k].client->nickname;
+ char *m, *n = channel->clients[k].client->nickname;
len2 = strlen(n);
len1 += len2;
- name_list = silc_realloc(name_list, sizeof(*name_list) * (len1 + 1));
+
+ name_list = silc_realloc(name_list, sizeof(*name_list) * (len1 + 3));
+
+ m = silc_client_chumode_char(channel->clients[k].mode);
+ if (m) {
+ memcpy(name_list + (len1 - len2), m, strlen(m));
+ len1 += strlen(m);
+ silc_free(m);
+ }
+
memcpy(name_list + (len1 - len2), n, len2);
name_list[len1] = 0;