Added support for notify client operation.
authorPekka Riikonen <priikone@silcnet.org>
Fri, 29 Sep 2000 07:10:32 +0000 (07:10 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Fri, 29 Sep 2000 07:10:32 +0000 (07:10 +0000)
apps/silc/client_ops.c
lib/silcclient/README
lib/silcclient/client.c
lib/silcclient/ops.h

index 3a08a798aed1ad0e2753030f97270ef5bca03abd..0dd9d1ef7859ea6cada76443e7f107418ca28f59 100644 (file)
@@ -64,6 +64,16 @@ void silc_private_message(SilcClient client, SilcClientConnection conn,
   silc_print(client, "*%s* %s", sender, msg);
 }
 
+
+/* Notify message to the client.  The `type' is the notify type received
+   from server.  The `msg' is a human readable message sent by the server. */
+
+void silc_notify(SilcClient client, SilcClientConnection conn, 
+                SilcNotifyType type, char *msg)
+{
+  silc_print(client, "*** %s", msg);
+}
+
 /* Command handler. This function is called always in the command function.
    If error occurs it will be called as well. `conn' is the associated
    client connection. `cmd_context' is the command context that was
@@ -401,6 +411,7 @@ SilcClientOperations ops = {
   say:                  silc_say,
   channel_message:      silc_channel_message,
   private_message:      silc_private_message,
+  notify:               silc_notify,
   command:              silc_command,
   command_reply:        silc_command_reply,
   connect:              silc_connect,
index 26eb38588397ca08265c53f6c0f334f3b2e19b14..60af009cde2ab00e590b27540b4abb6f8f4d350a 100644 (file)
@@ -46,6 +46,7 @@ SilcClientOperations ops = {
   say:                  silc_say,
   channel_message:      silc_channel_message,
   private_message:      silc_private_message,
+  notify:               silc_notify,
   command:              silc_command,
   command_reply:        silc_command_reply,
   connect:              silc_connect,
index 66961bf82796ad075138633bf9d40ae44cb2ac67..f4a2b795b8a6c85ca6664d3ae1fcdc9e637be621 100644 (file)
@@ -1246,10 +1246,14 @@ void silc_client_notify_by_server(SilcClient client,
                                  SilcBuffer message)
 {
   char *msg;
+  SilcNotifyType type;
+
+  SILC_GET16_MSB(type, message->data);
+  silc_buffer_pull(message, 2);
 
   msg = silc_calloc(message->len + 1, sizeof(char));
   memcpy(msg, message->data, message->len);
-  client->ops->say(client, sock->user_data, msg);
+  client->ops->notify(client, sock->user_data, type, msg);
   silc_free(msg);
 }
 
@@ -1395,7 +1399,7 @@ void silc_client_channel_message(SilcClient client,
 
   id = silc_id_str2id(packet->dst_id, SILC_ID_CHANNEL);
 
-  /* Find the channel entry from channels on this window */
+  /* Find the channel entry from channels on this connection */
   if (!silc_idcache_find_by_id_one(conn->channel_cache, (void *)id,
                                   SILC_ID_CHANNEL, &id_cache))
     goto out;
index 49d3b8c48a7e20fe914dd2cc01d046feff51c721..69eb54e5df1621614f19fd112950b0cf957ddfc1 100644 (file)
@@ -37,6 +37,8 @@ typedef struct {
                          char *sender, char *channel_name, char *msg);
   void (*private_message)(SilcClient client, SilcClientConnection conn,
                          char *sender, char *msg);
+  void (*notify)(SilcClient client, SilcClientConnection conn, 
+                SilcNotifyType type, char *msg);
   void (*command)(SilcClient client, SilcClientConnection conn, 
                  SilcClientCommandContext cmd_context, int success,
                  SilcCommand command);
@@ -80,6 +82,13 @@ typedef struct {
    sender received in the packet.
 
 
+   void (*notify)(SilcClient client, SilcClientConnection conn, 
+                 SilcNotifyType type, char *msg);
+
+   Notify message to the client.  The `type' is the notify type received
+   from server.  The `msg' is a human readable message sent by the server.
+
+
    void (*command)(SilcClient client, SilcClientConnection conn, 
                   SilcClientCommandContext cmd_context, int success,
                   SilcCommand command);