fixed some CMODE_CHANGE notify handling in server and router.
Affected file is silcd/packet_receive.c.
+ * Changed "disconnect" client operation to include the
+ reason of the disconnection and optional disconnection
+ message. Affected file lib/silcclient/silcclient.h.
+
Sat Jun 22 12:49:21 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
* All CMODE_CHANGE and CUMODE_CHANGE notifys are now sent back
/* Called to indicate that connection was disconnected to the server. */
-void silc_disconnect(SilcClient client, SilcClientConnection conn)
+void silc_disconnect(SilcClient client, SilcClientConnection conn,
+ SilcStatus status, const char *message)
{
SILC_SERVER_REC *server = conn->context;
silc_change_nick(server, silc_client->username);
}
+ if (message)
+ silc_say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
+ "Server closed connection: %s (%d) %s",
+ silc_get_status_message(status), status,
+ message ? message : "");
+
server->conn->context = NULL;
server->conn = NULL;
server->connection_lost = TRUE;
SilcCommand command, SilcStatus status, ...);
void silc_connect(SilcClient client, SilcClientConnection conn,
SilcClientConnectionStatus status);
-void silc_disconnect(SilcClient client, SilcClientConnection conn);
+void silc_disconnect(SilcClient client, SilcClientConnection conn,
+ SilcStatus status, const char *message);
void silc_ask_passphrase(SilcClient client, SilcClientConnection conn,
SilcAskPassphrase completion, void *context);
void silc_verify_public_key(SilcClient client, SilcClientConnection conn,
close the connection */
if (SILC_IS_DISCONNECTING(sock)) {
if (sock == conn->sock && sock->type != SILC_SOCKET_TYPE_CLIENT)
- client->internal->ops->disconnect(client, conn);
+ client->internal->ops->disconnect(client, conn, 0, NULL);
silc_client_close_connection_real(client, sock, conn);
return;
}
SILC_LOG_DEBUG(("EOF from connection %d", sock->sock));
if (sock == conn->sock && sock->type != SILC_SOCKET_TYPE_CLIENT)
- client->internal->ops->disconnect(client, conn);
+ client->internal->ops->disconnect(client, conn, 0, NULL);
silc_client_close_connection_real(client, sock, conn);
return;
}
SILC_TASK_CALLBACK(silc_client_disconnected_by_server_later)
{
SilcClient client = (SilcClient)context;
- SilcClientConnection conn;
SilcSocketConnection sock;
SILC_CLIENT_GET_SOCK(client, fd, sock);
if (sock == NULL)
return;
- conn = (SilcClientConnection)sock->user_data;
- if (sock == conn->sock && sock->type != SILC_SOCKET_TYPE_CLIENT)
- client->internal->ops->disconnect(client, conn);
-
silc_client_close_connection_real(client, sock, sock->user_data);
}
SilcSocketConnection sock,
SilcBuffer packet)
{
+ SilcClientConnection conn;
SilcStatus status;
char *message = NULL;
silc_utf8_valid(packet->data + 1, packet->len - 1))
message = silc_memdup(packet->data + 1, packet->len - 1);
- client->internal->ops->say(client, sock->user_data,
- SILC_CLIENT_MESSAGE_AUDIT,
- "Server closed connection: %s (%d) %s",
- silc_get_status_message(status), status,
- message ? message : "");
+ conn = (SilcClientConnection)sock->user_data;
+ if (sock == conn->sock && sock->type != SILC_SOCKET_TYPE_CLIENT)
+ client->internal->ops->disconnect(client, conn, status, message);
+
silc_free(message);
SILC_SET_DISCONNECTED(sock);
}
-/* Called to indicate that connection was disconnected to the server. */
+/* Called to indicate that connection was disconnected to the server.
+ The `status' may tell the reason of the disconnection, and if the
+ `message' is non-NULL it may include the disconnection message
+ received from server. */
static void
-silc_disconnect(SilcClient client, SilcClientConnection conn)
+silc_disconnect(SilcClient client, SilcClientConnection conn,
+ SilcStatus status, const char *message)
{
}
QuitInternal q = (QuitInternal)context;
/* Close connection */
- q->client->internal->ops->disconnect(q->client, q->conn);
+ q->client->internal->ops->disconnect(q->client, q->conn, 0, NULL);
silc_client_close_connection(q->client, q->conn->sock->user_data);
silc_free(q);
void (*connect)(SilcClient client, SilcClientConnection conn,
SilcClientConnectionStatus status);
- /* Called to indicate that connection was disconnected to the server. */
- void (*disconnect)(SilcClient client, SilcClientConnection conn);
+ /* Called to indicate that connection was disconnected to the server.
+ The `status' may tell the reason of the disconnection, and if the
+ `message' is non-NULL it may include the disconnection message
+ received from server. */
+ void (*disconnect)(SilcClient client, SilcClientConnection conn,
+ SilcStatus status, const char *message);
/* Find authentication method and authentication data by hostname and
port. The hostname may be IP address as well. When the authentication