+Thu Jun 28 21:30:39 EEST 2001 Pekka Riikonen <priikone@silcnet.org>
+
+ * Changed the `say' client operation's interface to accept
+ new `type' argument to indicate the type of the message sent
+ by the library. The application may filter the library's
+ messages according the type. The affected file is the
+ lib/silcclient/silcapi.h.
+
+ * Added two new functions to lib/silcclient/silcapi.h:
+ silc_client_del_client and silc_client_del_client_by_id.
+ Affected file lib/silcclient/idlist.c.
+
+ * Moved the clientincludes.h from includes/ to silc/ and
+ serverincludes.h from includes/ to silcd/.
+
+ * The modes for the CMODE and CUMODE are now passed as
+ uint32 for application with COMMAND_REPLY. The affected
+ file is lib/silcclient/command_reply.c.
+
Wed Jun 27 22:24:47 EEST 2001 Pekka Riikonen <priikone@silcnet.org>
* /WHOIS without arguments shows client's own information.
================================
o Library should save the cumode and not start from 0 everytime then
- CUMODE is issued.
-
- o Add some silc_client_del_client and other deletion funtions for
- application to delete client entrys from the cache.
+ CUMODE is issued. A mechanism of getting the channel entry for
+ CMODE and CUMODE by the command reply identifier must be added.
+ Otherwise saving the modes for the channels and channel user
+ entries are impossible since server does not send Channel ID as
+ command reply in these functions.
o All protocol execution timeouts are hard coded. They should be
configurable and the Irssi SILC client should be able to set them
o silc_client_close_connection leaks memory. Read the XXX from code.
- o Some of the ops->say's should be removed and moved to the application
- from the library. Go through these.
-
o The client library must manage somehow when receiving client that has
same nickname, same server, same username but different Client ID than
what we have in the cache. It is now assumed that they are different
interface separately or it could just remove the old client unless
it is on some channels.
- o Add client library parameters or options that handle what kind of
- messages the library should print out (using `say' client operation,
- for example) and what is left for the application to print. The
- appliation could for example set that it handles all command printing
- but all error printing should be handled by the library, etc...
- This is not a showstopper.
-
TODO/bugs In SILC Server
========================
to start writing one myself. Anyhow, the OpenSSL X.509 lib should
be checked.
+ Other package that should be checked is the NSS's X509 library.
+
o SSH2 public keys support. Maybe - not really needed but could be
nice as SSH is widely used all over the place. SILC Protocol
supports SSH2 public keys.
SilcVerifyPublicKey completion, void *context);
void silc_say(SilcClient client, SilcClientConnection conn,
- char *msg, ...)
+ SilcClientMessageType type, char *msg, ...)
{
SILC_SERVER_REC *server;
va_list va;
#ifndef CLIENT_OPS_H
#define CLIENT_OPS_H
-void silc_say(SilcClient client, SilcClientConnection conn, char *msg, ...);
+void silc_say(SilcClient client, SilcClientConnection conn,
+ SilcClientMessageType type, char *msg, ...);
void silc_say_error(char *msg, ...);
void silc_channel_message(SilcClient client, SilcClientConnection conn,
SilcClientEntry sender,
g_free(tmp);
if (argc < 4) {
- silc_say(silc_client, conn, "Usage: /KEY msg|channel <nickname|channel> "
+ silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO,
+ "Usage: /KEY msg|channel <nickname|channel> "
"set|unset|agreement|negotiate [<arguments>]");
return;
}
type = 2;
if (type == 0) {
- silc_say(silc_client, conn, "Usage: /KEY msg|channel <nickname|channel> "
+ silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO,
+ "Usage: /KEY msg|channel <nickname|channel> "
"set|unset|agreement|negotiate [<arguments>]");
return;
}
else
strcat(buf, "*generated*");
- silc_say(silc_client, conn, "%s", buf);
+ silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO, "%s", buf);
}
} else {
printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP,
else
strcat(buf, "*generated*");
- silc_say(silc_client, conn, "%s", buf);
+ silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO, "%s", buf);
}
}
strcat(buf, "<hidden>");
- silc_say(silc_client, conn, "%s", buf);
+ silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO, "%s", buf);
}
silc_client_free_channel_private_keys(keys, keys_count);
}
if (command == 0) {
- silc_say(silc_client, conn, "Usage: /KEY msg|channel <nickname|channel> "
+ silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO,
+ "Usage: /KEY msg|channel <nickname|channel> "
"set|unset|agreement|negotiate [<arguments>]");
goto out;
}
return FALSE;
}
+void silc_say(SilcClient client, SilcClientConnection conn,
+ char *msg, ...)
+{
+ va_list vp;
+ char message[2048];
+ SilcClientInternal app = (SilcClientInternal)client->application;
+
+ memset(message, 0, sizeof(message));
+ strncat(message, "\n*** ", 5);
+
+ va_start(vp, msg);
+ vsprintf(message + 5, msg, vp);
+ va_end(vp);
+
+ /* Print the message */
+ silc_print_to_window(app->screen->output_win[0], message);
+}
+
/* Prints a message with three star (*) sign before the actual message
on the current output window. This is used to print command outputs
and error messages. */
-void silc_say(SilcClient client, SilcClientConnection conn,
- char *msg, ...)
+void silc_op_say(SilcClient client, SilcClientConnection conn,
+ SilcClientMessageType type, char *msg, ...)
{
va_list vp;
char message[2048];
k++;
}
- client->ops->say(client, conn, "Users on %s: %s", channel->channel_name,
+ silc_say(client, conn, "Users on %s: %s", channel->channel_name,
name_list);
silc_free(name_list);
}
tmp = silc_argument_get_arg_type(silc_command_get_args(cmd_payload),
3, NULL);
if (tmp)
- client->ops->say(client, conn, "%s: %s", tmp,
+ silc_say(client, conn, "%s: %s", tmp,
silc_client_command_status_message(status));
else
- client->ops->say(client, conn, "%s",
+ silc_say(client, conn, "%s",
silc_client_command_status_message(status));
break;
}
strncat(buf, ")", 1);
}
- client->ops->say(client, conn, "%s", buf);
+ silc_say(client, conn, "%s", buf);
if (channels) {
SilcDList list = silc_channel_payload_parse_list(channels);
silc_free(m);
}
- client->ops->say(client, conn, "%s", buf);
+ silc_say(client, conn, "%s", buf);
silc_channel_payload_list_free(list);
}
}
if (mode) {
if ((mode & SILC_UMODE_SERVER_OPERATOR) ||
(mode & SILC_UMODE_ROUTER_OPERATOR))
- client->ops->say(client, conn, "%s is %s", nickname,
+ silc_say(client, conn, "%s is %s", nickname,
(mode & SILC_UMODE_SERVER_OPERATOR) ?
"Server Operator" :
(mode & SILC_UMODE_ROUTER_OPERATOR) ?
"SILC Operator" : "[Unknown mode]");
if (mode & SILC_UMODE_GONE)
- client->ops->say(client, conn, "%s is gone", nickname);
+ silc_say(client, conn, "%s is gone", nickname);
}
if (idle && nickname)
- client->ops->say(client, conn, "%s has been idle %d %s",
+ silc_say(client, conn, "%s has been idle %d %s",
nickname,
idle > 60 ? (idle / 60) : idle,
idle > 60 ? "minutes" : "seconds");
tmp = silc_argument_get_arg_type(silc_command_get_args(cmd_payload),
3, NULL);
if (tmp)
- client->ops->say(client, conn, "%s: %s", tmp,
+ silc_say(client, conn, "%s: %s", tmp,
silc_client_command_status_message(status));
else
- client->ops->say(client, conn, "%s",
+ silc_say(client, conn, "%s",
silc_client_command_status_message(status));
break;
}
strncat(buf, ")", 1);
}
- client->ops->say(client, conn, "%s", buf);
+ silc_say(client, conn, "%s", buf);
}
break;
client_id_list = va_arg(vp, SilcBuffer);
if (topic)
- client->ops->say(client, conn, "Topic for %s: %s",
+ silc_say(client, conn, "Topic for %s: %s",
app->screen->bottom_line->channel, topic);
app->screen->bottom_line->channel_mode =
/* SILC client operations */
SilcClientOperations ops = {
- silc_say,
+ silc_op_say,
silc_channel_message,
silc_private_message,
silc_notify,
#define CLIENT_OPS_H
void silc_say(SilcClient client, SilcClientConnection conn, char *msg, ...);
+void silc_op_say(SilcClient client, SilcClientConnection conn,
+ SilcClientMessageType type, char *msg, ...);
void silc_channel_message(SilcClient client, SilcClientConnection conn,
SilcClientEntry sender,
SilcChannelEntry channel,
/* Set the private key for this client */
silc_client_del_private_message_key(client, conn, client_entry);
silc_client_add_private_message_key_ske(client, conn, client_entry,
- NULL, key);
+ NULL, key, FALSE);
silc_say(client, conn, "The private messages with the %s are now protected with the private key", client_entry->nickname);
silc_ske_free_key_material(key);
}
if (cmd->argv[2][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ silc_say(cmd->client, conn, "You are not on any channel");
goto out;
}
name = conn->current_channel->channel_name;
if (curr_key && type == 1 && client_entry) {
silc_client_del_private_message_key(client, conn, client_entry);
silc_client_add_private_message_key_ske(client, conn, client_entry,
- NULL, curr_key);
+ NULL, curr_key, FALSE);
goto out;
}
}
cmd->argv[5], cmd->argv[4],
cmd->argv_lens[4],
(cmd->argv[4][0] == '*' ?
- TRUE : FALSE));
+ TRUE : FALSE), FALSE);
else
silc_client_add_private_message_key(client, conn, client_entry,
NULL, cmd->argv[4],
cmd->argv_lens[4],
(cmd->argv[4][0] == '*' ?
- TRUE : FALSE));
+ TRUE : FALSE), FALSE);
/* Send the key to the remote client so that it starts using it
too. */
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ silc_say(cmd->client, conn, "You are not on any channel");
goto out;
}
name = conn->current_channel->channel_name;
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ silc_say(cmd->client, conn, "You are not on any channel");
goto out;
}
name = conn->current_channel->channel_name;
conn = silc_client_add_connection(client, host, port, context);
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Connecting to port %d of server %s", port, host);
/* Allocate internal context for connection process. This is
&protocol, (void *)proto_ctx,
silc_client_connect_to_server_second);
if (!protocol) {
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Error: Could not start authentication protocol");
return FALSE;
}
if (opt != 0) {
if (ctx->tries < 2) {
/* Connection failed but lets try again */
- client->ops->say(client, conn, "Could not connect to server %s: %s",
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
+ "Could not connect to server %s: %s",
ctx->host, strerror(opt));
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Connecting to port %d of server %s resumed",
ctx->port, ctx->host);
ctx->tries++;
} else {
/* Connection failed and we won't try anymore */
- client->ops->say(client, conn, "Could not connect to server %s: %s",
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
+ "Could not connect to server %s: %s",
ctx->host, strerror(opt));
silc_schedule_unset_listen_fd(client->schedule, fd);
silc_net_close_connection(fd);
msg = silc_calloc(message->len + 1, sizeof(char));
memcpy(msg, message->data, message->len);
- client->ops->say(client, sock->user_data, msg);
+ client->ops->say(client, sock->user_data, SILC_CLIENT_MESSAGE_AUDIT, msg);
silc_free(msg);
SILC_SET_DISCONNECTED(sock);
msg = silc_calloc(message->len + 1, sizeof(char));
memcpy(msg, message->data, message->len);
- client->ops->say(client, sock->user_data, msg);
+ client->ops->say(client, sock->user_data, SILC_CLIENT_MESSAGE_AUDIT, msg);
silc_free(msg);
}
memcpy(channel->key, key, tmp_len);
if (!silc_cipher_alloc(cipher, &channel->channel_key)) {
- conn->client->ops->say(conn->client, conn,
+ conn->client->ops->say(conn->client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Cannot talk to channel: unsupported cipher %s", cipher);
goto out;
}
sock = silc_net_accept_connection(ke->fd);
if (sock < 0) {
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Could not accept key agreement connection: ",
strerror(errno));
ke->client_entry->ke = NULL;
/* Perform name and address lookups for the remote host. */
silc_net_check_host_by_sock(sock, &newsocket->hostname, &newsocket->ip);
if (!newsocket->hostname && !newsocket->ip) {
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Could not resolve the remote IP or hostname");
ke->client_entry->ke = NULL;
ke->completion(ke->client, ke->conn, ke->client_entry,
ke->fd = silc_net_create_server(port, hostname);
if (ke->fd < 0) {
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot create listener on %s on port %d: %s",
hostname, port, strerror(errno));
completion(client, conn, client_entry, SILC_KEY_AGREEMENT_FAILURE,
if (opt != 0) {
if (ctx->tries < 2) {
/* Connection failed but lets try again */
- client->ops->say(client, conn, "Could not connect to client %s: %s",
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
+ "Could not connect to client %s: %s",
ctx->host, strerror(opt));
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Connecting to port %d of client %s resumed",
ctx->port, ctx->host);
ctx->tries++;
} else {
/* Connection failed and we won't try anymore */
- client->ops->say(client, conn, "Could not connect to client %s: %s",
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
+ "Could not connect to client %s: %s",
ctx->host, strerror(opt));
silc_schedule_unset_listen_fd(client->schedule, fd);
silc_net_close_connection(fd);
goto out;
/* Print some info for application */
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Received private message key from %s%s%s %s%s%s",
clients[0]->nickname,
clients[0]->server ? "@" : "",
};
#define SILC_NOT_CONNECTED(x, c) \
- x->ops->say((x), (c), \
+ x->ops->say((x), (c), SILC_CLIENT_MESSAGE_ERROR, \
"You are not connected to a server, use /SERVER to connect");
/* Command operation that is called at the end of all commands.
}
if (cmd->argc < 2 || cmd->argc > 3) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /WHOWAS <nickname>[@<server>] [<count>]");
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 2 || cmd->argc > 3) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /IDENTIFY <nickname>[@<server>] [<count>]");
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 2) {
- cmd->client->ops->say(cmd->client, conn, "Usage: /NICK <nickname>");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "Usage: /NICK <nickname>");
COMMAND_ERROR;
goto out;
}
/* Show current nickname */
if (cmd->argc < 2) {
if (cmd->conn) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Your nickname is %s on server %s",
conn->nickname, conn->remote_host);
} else {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Your nickname is %s", conn->nickname);
}
}
if (cmd->argc < 2 || cmd->argc > 3) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /TOPIC <channel> [<topic>]");
COMMAND_ERROR;
goto out;
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on any channel");
COMMAND_ERROR;
goto out;
}
}
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on that channel");
COMMAND_ERROR;
goto out;
}
/* Get the Channel ID of the channel */
if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
- cmd->client->ops->say(cmd->client, conn, "You are not on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on that channel");
COMMAND_ERROR;
goto out;
}
}
if (cmd->argc < 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /INVITE <channel> [<nickname>[@server>]"
"[+|-[<nickname>[@<server>[!<username>[@hostname>]]]]]");
COMMAND_ERROR;
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on any channel");
COMMAND_ERROR;
goto out;
}
channel = silc_client_get_channel(cmd->client, conn, name);
if (!channel) {
- cmd->client->ops->say(cmd->client, conn, "You are on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are on that channel");
COMMAND_ERROR;
goto out;
}
if (cmd->argc == 3) {
if (cmd->argv[2][0] != '+' && cmd->argv[2][0] != '-') {
if (!silc_parse_nickname(cmd->argv[2], &nickname, &server, &num)) {
- cmd->client->ops->say(cmd->client, conn, "Bad nickname");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "Bad nickname");
COMMAND_ERROR;
goto out;
}
}
if (cmd->argc < 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /KILL <nickname> [<comment>]");
COMMAND_ERROR;
goto out;
/* Parse the typed nickname. */
if (!silc_parse_nickname(cmd->argv[1], &nickname, &server, &num)) {
- cmd->client->ops->say(cmd->client, conn, "Bad nickname");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "Bad nickname");
COMMAND_ERROR;
goto out;
}
SilcBuffer buffer;
void *id;
int i;
- char *name = NULL;
if (!cmd->conn) {
SILC_NOT_CONNECTED(cmd->client, cmd->conn);
if (silc_idcache_find_by_name_one(conn->channel_cache, cmd->argv[1],
&id_cache)) {
#if 0
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"You are talking to channel %s", cmd->argv[1]);
conn->current_channel = (SilcChannelEntry)id_cache->context;
cmd->client->screen->bottom_line->channel = cmd->argv[1];
}
if (cmd->argc < 1 || cmd->argc > 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /MOTD [<server>]");
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /UMODE +|-<modes>");
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 3) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
COMMAND_ERROR;
goto out;
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on any channel");
COMMAND_ERROR;
goto out;
}
channel = silc_client_get_channel(cmd->client, conn, name);
if (!channel) {
- cmd->client->ops->say(cmd->client, conn, "You are on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are on that channel");
COMMAND_ERROR;
goto out;
}
mode |= SILC_CHANNEL_MODE_ULIMIT;
type = 3;
if (cmd->argc < 4) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
COMMAND_ERROR;
goto out;
mode |= SILC_CHANNEL_MODE_PASSPHRASE;
type = 4;
if (cmd->argc < 4) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
COMMAND_ERROR;
goto out;
mode |= SILC_CHANNEL_MODE_CIPHER;
type = 5;
if (cmd->argc < 4) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
COMMAND_ERROR;
goto out;
mode |= SILC_CHANNEL_MODE_HMAC;
type = 6;
if (cmd->argc < 4) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
COMMAND_ERROR;
goto out;
type = 7;
if (cmd->argc < 4) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 4) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /CUMODE <channel> +|-<modes> <nickname>[@<server>]");
COMMAND_ERROR;
goto out;
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on any channel");
COMMAND_ERROR;
goto out;
}
channel = silc_client_get_channel(cmd->client, conn, name);
if (!channel) {
- cmd->client->ops->say(cmd->client, conn, "You are on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are on that channel");
COMMAND_ERROR;
goto out;
}
/* Parse the typed nickname. */
if (!silc_parse_nickname(cmd->argv[3], &nickname, &server, &num)) {
- cmd->client->ops->say(cmd->client, conn, "Bad nickname");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "Bad nickname");
COMMAND_ERROR;
goto out;
}
return;
}
+ /* Get the current mode */
while ((chu = silc_list_get(channel->clients)) != SILC_LIST_END) {
if (chu->client == client_entry) {
- chu->mode = mode;
+ mode = chu->mode;
break;
}
}
}
if (cmd->argc < 3) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /KICK <channel> <nickname> [<comment>]");
COMMAND_ERROR;
goto out;
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on any channel");
COMMAND_ERROR;
goto out;
}
}
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on that channel");
COMMAND_ERROR;
goto out;
}
/* Get the Channel ID of the channel */
if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
- cmd->client->ops->say(cmd->client, conn, "You are not on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on that channel");
COMMAND_ERROR;
goto out;
}
/* Parse the typed nickname. */
if (!silc_parse_nickname(cmd->argv[2], &nickname, &server, &num)) {
- cmd->client->ops->say(cmd->client, conn, "Bad nickname");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "Bad nickname");
COMMAND_ERROR;
goto out;
}
target = silc_idlist_get_client(cmd->client, conn, nickname,
server, num, FALSE);
if (!target) {
- cmd->client->ops->say(cmd->client, conn, "No such client: %s",
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "No such client: %s",
cmd->argv[2]);
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /OPER <username> [<public key>]");
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /SILCOPER <username> [<public key>]");
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /CONNECT <server> [<port>]");
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /BAN <channel> "
"[+|-[<nickname>[@<server>[!<username>[@hostname>]]]]]");
COMMAND_ERROR;
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on any channel");
COMMAND_ERROR;
goto out;
}
channel = silc_client_get_channel(cmd->client, conn, name);
if (!channel) {
- cmd->client->ops->say(cmd->client, conn, "You are on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are on that channel");
COMMAND_ERROR;
goto out;
}
}
if (cmd->argc < 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Usage: /CLOSE <server> [<port>]");
COMMAND_ERROR;
goto out;
}
if (cmd->argc != 2) {
- cmd->client->ops->say(cmd->client, conn, "Usage: /LEAVE <channel>");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "Usage: /LEAVE <channel>");
COMMAND_ERROR;
goto out;
}
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on any channel");
COMMAND_ERROR;
goto out;
}
/* Get the Channel ID of the channel */
if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
- cmd->client->ops->say(cmd->client, conn, "You are not on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on that channel");
COMMAND_ERROR;
goto out;
}
}
if (cmd->argc != 2) {
- cmd->client->ops->say(cmd->client, conn, "Usage: /USERS <channel>");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "Usage: /USERS <channel>");
COMMAND_ERROR;
goto out;
}
if (cmd->argv[1][0] == '*') {
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on any channel");
COMMAND_ERROR;
goto out;
}
}
if (!conn->current_channel) {
- cmd->client->ops->say(cmd->client, conn, "You are not on that channel");
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "You are not on that channel");
COMMAND_ERROR;
goto out;
}
/* Get the Channel ID of the channel */
if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
/* XXX should resolve the channel ID; LIST command */
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"You are not on that channel", name);
COMMAND_ERROR;
goto out;
}
if (cmd->argc < 2) {
- client->ops->say(client, conn, "Usage: /GETKEY <nickname>");
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_INFO, "Usage: /GETKEY <nickname>");
COMMAND_ERROR;
goto out;
}
/* Parse the typed nickname. */
if (!silc_parse_nickname(cmd->argv[1], &nickname, &server, &num)) {
- client->ops->say(client, conn, "Bad nickname");
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_INFO, "Bad nickname");
COMMAND_ERROR;
goto out;
}
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn, "Cannot set nickname: %s",
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+ "Cannot set nickname: %s",
silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
argc = silc_argument_get_arg_num(cmd->args);
if (argc < 2 || argc > 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot set nickname: bad reply to command");
COMMAND_REPLY_ERROR;
goto out;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_TOPIC);
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_INVITE);
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_INFO);
if (!tmp)
goto out;
- client->ops->say(cmd->client, conn, "Info: %s", tmp);
+ client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
+ "Info: %s", tmp);
/* Notify application */
COMMAND_REPLY((ARGS, NULL, (char *)tmp));
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
for (i = 0; i < conn->ping_count; i++) {
if (SILC_ID_SERVER_COMPARE(conn->ping[i].dest_id, id)) {
diff = curtime - conn->ping[i].start_time;
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Ping reply from %s: %d second%s",
conn->ping[i].dest_name, diff,
diff == 1 ? "" : "s");
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
argc = silc_argument_get_arg_num(cmd->args);
if (argc < 7 || argc > 14) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot join channel: Bad reply packet");
COMMAND_REPLY_ERROR;
goto out;
/* Get channel name */
tmp = silc_argument_get_arg_type(cmd->args, 2, NULL);
if (!tmp) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot join channel: Bad reply packet");
COMMAND_REPLY_ERROR;
goto out;
/* Get Channel ID */
tmp = silc_argument_get_arg_type(cmd->args, 3, &len);
if (!tmp) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot join channel: Bad reply packet");
COMMAND_REPLY_ERROR;
silc_free(channel_name);
hmac = silc_argument_get_arg_type(cmd->args, 11, NULL);
if (hmac) {
if (!silc_hmac_alloc(hmac, NULL, &channel->hmac)) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot join channel: Unsupported HMAC `%s'",
hmac);
COMMAND_REPLY_ERROR;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
return;
if (i == 2)
line[0] = ' ';
- cmd->client->ops->say(cmd->client, conn, "%s", line);
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
+ "%s", line);
if (!strlen(cp))
break;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
SilcClientConnection conn = (SilcClientConnection)cmd->sock->user_data;
SilcCommandStatus status;
unsigned char *tmp;
+ uint32 mode;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
goto out;
}
+ SILC_GET32_MSB(mode, tmp);
+
/* Notify application */
- COMMAND_REPLY((ARGS, tmp));
+ COMMAND_REPLY((ARGS, mode));
/* Execute any pending command callbacks */
SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_CMODE);
SilcIDCacheEntry id_cache = NULL;
SilcClientID *client_id;
unsigned char *tmp, *id;
- uint32 len;
+ uint32 len, mode;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
goto out;
}
+ SILC_GET32_MSB(mode, tmp);
+
/* Notify application */
- COMMAND_REPLY((ARGS, tmp, (SilcClientEntry)id_cache->context));
+ COMMAND_REPLY((ARGS, mode, (SilcClientEntry)id_cache->context));
silc_free(client_id);
/* Execute any pending command callbacks */
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
(void *)i);
}
+/* Removes client from the cache by the client entry. */
+
+bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
+ SilcClientEntry client_entry)
+{
+ return silc_idcache_del_by_context(conn->client_cache, client_entry);
+}
+
+/* Removes client from the cache by the client ID. */
+
+bool silc_client_del_client_by_id(SilcClient client,
+ SilcClientConnection conn,
+ SilcClientID *client_id)
+{
+ return silc_idcache_del_by_id_ext(conn->client_cache, (void *)client_id,
+ NULL, NULL,
+ silc_hash_client_id_compare, NULL);
+}
+
/* Finds entry for channel by the channel name. Returns the entry or NULL
if the entry was not found. It is found only if the client is joined
to the channel. */
status = SILC_SKE_STATUS_BAD_VERSION;
if (status != SILC_SKE_STATUS_OK)
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"We don't support server version `%s'", version);
return status;
if (ske->status != SILC_SKE_STATUS_OK) {
if (ske->status == SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY) {
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Received unsupported server %s public key",
ctx->sock->hostname);
} else if (ske->status == SILC_SKE_STATUS_PUBLIC_KEY_NOT_PROVIDED) {
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Remote host did not send its public key, even though "
"it must send it");
} else {
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Error during key exchange protocol with server %s",
ctx->sock->hostname);
}
if (status != SILC_SKE_STATUS_OK) {
if (status == SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY) {
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Received unsupported server %s public key",
ctx->sock->hostname);
} else {
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Error during key exchange protocol with server %s",
ctx->sock->hostname);
}
break;
}
- client->ops->say(client, conn,
+ client->ops->say(client, conn, SILC_CLIENT_MESSAGE_INFO,
"Password authentication required by server %s",
ctx->sock->hostname);
client->ops->ask_passphrase(client, conn,
***/
typedef void (*SilcVerifyPublicKey)(bool success, void *context);
+/****d* silcclient/SilcClientAPI/SilcClientMessageType
+ *
+ * NAME
+ *
+ * typedef enum { ... } SilcClientMessageType;
+ *
+ * DESCRIPTION
+ *
+ * Different message types for `say' client operation. The application
+ * may filter the message sent by the library according this type.
+ *
+ * SOURCE
+ */
+typedef enum {
+ SILC_CLIENT_MESSAGE_INFO, /* Informational */
+ SILC_CLIENT_MESSAGE_WARNING, /* Warning */
+ SILC_CLIENT_MESSAGE_ERROR, /* Error */
+ SILC_CLIENT_MESSAGE_AUDIT, /* Auditable */
+} SilcClientMessageType;
+/***/
+
/****s* silcclient/SilcClientAPI/SilcClientOperations
*
* NAME
*/
typedef struct {
/* Message sent to the application by library. `conn' associates the
- message to a specific connection. `conn', however, may be NULL. */
- void (*say)(SilcClient client, SilcClientConnection conn, char *msg, ...);
+ message to a specific connection. `conn', however, may be NULL.
+ The `type' indicates the type of the message sent by the library.
+ The applicationi can for example filter the message according the
+ type. */
+ void (*say)(SilcClient client, SilcClientConnection conn,
+ SilcClientMessageType type, char *msg, ...);
/* Message for a channel. The `sender' is the sender of the message
The `channel' is the channel. */
SilcGetClientCallback completion,
void *context);
+/****f* silcclient/SilcClientAPI/silc_client_del_client
+ *
+ * SYNOPSIS
+ *
+ * bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
+ * SilcClientEntry client_entry)
+ *
+ * DESCRIPTION
+ *
+ * Removes client from local cache by the client entry indicated by
+ * the `client_entry'. Returns TRUE if the deletion were successful.
+ *
+ ***/
+bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
+ SilcClientEntry client_entry);
+
+/****f* silcclient/SilcClientAPI/silc_client_del_client_by_id
+ *
+ * SYNOPSIS
+ *
+ * bool silc_client_del_client_by_id(SilcClient client,
+ * SilcClientConnection conn,
+ * SilcClientID *client_id);
+ *
+ * DESCRIPTION
+ *
+ * Removes client from local cache by the Client ID indicated by
+ * the `Client ID'. Returns TRUE if the deletion were successful.
+ *
+ ***/
+bool silc_client_del_client_by_id(SilcClient client,
+ SilcClientConnection conn,
+ SilcClientID *client_id);
+
/****f* silcclient/SilcClientAPI/silc_client_get_channel
*
* SYNOPSIS