updates.
[silc.git] / lib / silcclient / client_ops_example.c
index d472a0571a770e9dc22485237969863d651c4067..6662e8550d1c84dcacae20570f953ab73854dcd7 100644 (file)
@@ -5,7 +5,7 @@
 
    At the end of this file SilcClientOperation structure is defined, and
    it is the one the you will give as an argument to the silc_client_alloc
-   function. See also lib/silcclient/README file, and silcapi.h. */
+   function. See also lib/silcclient/README file, and silcclient.h. */
 
 
 /* Message sent to the application by library. `conn' associates the
@@ -29,7 +29,8 @@ silc_say(SilcClient client, SilcClientConnection conn,
 static void 
 silc_channel_message(SilcClient client, SilcClientConnection conn, 
                     SilcClientEntry sender, SilcChannelEntry channel, 
-                    SilcMessageFlags flags, char *msg)
+                    SilcMessageFlags flags, const unsigned char *message,
+                    SilcUInt32 message_len);
 {
 
 }
@@ -40,7 +41,9 @@ silc_channel_message(SilcClient client, SilcClientConnection conn,
 
 static void 
 silc_private_message(SilcClient client, SilcClientConnection conn, 
-                    SilcClientEntry sender, SilcMessageFlags flags, char *msg)
+                    SilcClientEntry sender, SilcMessageFlags flags, 
+                    const unsigned char *message,
+                    SilcUInt32 message_len);
 {
 
 }
@@ -114,7 +117,8 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
    silc_client_close_connection. */
 
 static void 
-silc_connect(SilcClient client, SilcClientConnection conn, int success)
+silc_connect(SilcClient client, SilcClientConnection conn,
+            SilcClientConnectionStatus status);
 {
 
 }
@@ -137,7 +141,7 @@ silc_disconnect(SilcClient client, SilcClientConnection conn)
 
 static void 
 silc_get_auth_method(SilcClient client, SilcClientConnection conn, 
-                    char *hostname, uint16 port, SilcGetAuthMeth completion, 
+                    char *hostname, SilcUInt16 port, SilcGetAuthMeth completion, 
                     void *context)
 {
 
@@ -152,7 +156,7 @@ silc_get_auth_method(SilcClient client, SilcClientConnection conn,
 static void 
 silc_verify_public_key(SilcClient client, SilcClientConnection conn, 
                       SilcSocketType conn_type, unsigned char *pk, 
-                      uint32 pk_len, SilcSKEPKType pk_type, 
+                      SilcUInt32 pk_len, SilcSKEPKType pk_type, 
                       SilcVerifyPublicKey completion, void *context)
 {
 
@@ -161,7 +165,8 @@ silc_verify_public_key(SilcClient client, SilcClientConnection conn,
 
 /* Ask (interact, that is) a passphrase from user. The passphrase is
    returned to the library by calling the `completion' callback with
-   the `context'. */
+   the `context'. The returned passphrase SHOULD be in UTF-8 encoded,
+   if not then the library will attempt to encode. */
 
 static void 
 silc_ask_passphrase(SilcClient client, SilcClientConnection conn, 
@@ -198,7 +203,7 @@ silc_failure(SilcClient client, SilcClientConnection conn,
 static int 
 silc_key_agreement(SilcClient client, SilcClientConnection conn, 
                   SilcClientEntry client_entry, const char *hostname, 
-                  uint16 port, SilcKeyAgreementCallback *completion, 
+                  SilcUInt16 port, SilcKeyAgreementCallback *completion, 
                   void **context)
 {
 
@@ -214,8 +219,33 @@ silc_key_agreement(SilcClient client, SilcClientConnection conn,
 
 static void 
 silc_ftp(SilcClient client, SilcClientConnection conn, 
-        SilcClientEntry client_entry, uint32 session_id, 
-        const char *hostname, uint16 port)
+        SilcClientEntry client_entry, SilcUInt32 session_id, 
+        const char *hostname, SilcUInt16 port)
+{
+
+}
+
+
+/* Delivers SILC session detachment data indicated by `detach_data' to the 
+   application.  If application has issued SILC_COMMAND_DETACH command
+   the client session in the SILC network is not quit.  The client remains
+   in the network but is detached.  The detachment data may be used later
+   to resume the session in the SILC Network.  The appliation is 
+   responsible of saving the `detach_data', to for example in a file.
+
+   The detachment data can be given as argument to the functions
+   silc_client_connect_to_server, or silc_client_add_connection when
+   creating connection to remote server, inside SilcClientConnectionParams
+   structure.  If it is provided the client library will attempt to resume 
+   the session in the network.  After the connection is created 
+   successfully, the application is responsible of setting the user 
+   interface for user into the same state it was before detaching (showing 
+   same channels, channel modes, etc).  It can do this by fetching the
+   information (like joined channels) from the client library. */
+
+static void
+silc_detach(SilcClient client, SilcClientConnection conn,
+           const unsigned char *detach_data, SilcUInt32 detach_data_len)
 {
 
 }
@@ -237,5 +267,6 @@ SilcClientOperations ops = {
   silc_ask_passphrase,
   silc_failure,
   silc_key_agreement,
-  silc_ftp
+  silc_ftp,
+  silc_detach
 };