Allows formatted nicknames as input for silc_client_get_clients
[silc.git] / lib / silcclient / silcclient_entry.h
index 0f4e996a8572955a0576ef8bd308862a782459da..94106badbd4f10ef95a4bc0085de0f20a74e7119 100644 (file)
 
 */
 
+/****h* silcclient/Client Library Interface
+ *
+ * DESCRIPTION
+ *
+ * This header file includes the SilcClientEntry, SilcChannelEntry and
+ * SilcServer entry structures and various routines to search, resolve and
+ * handle these structures.
+ *
+ * All entries (SilcClientEntry, SilcChannelEntry and SilcServerEntry) are
+ * reference counted.  If application wishes to save an entry pointer it must
+ * always first acquire a reference.  The reference must be released once the
+ * entry is not needed anymore.  If application wants to read any data from
+ * the entry structure it must first lock the entry.  This protects access to
+ * the entries in multithreaded environment.  If threads are not used, locking
+ * the entries is not needed.  They however still must be referenced even
+ * when threads are not used.
+ *
+ ***/
+
 #ifndef SILCCLIENT_ENTRY_H
 #define SILCCLIENT_ENTRY_H
 
@@ -49,7 +68,7 @@
  *    it should always duplicated them.
  *
  *    None of the string arrays are set if the first character is '\0'.
- *    All string arrays are always NULL terminated.
+ *    All string arrays are always zero ('\0') terminated.
  *
  *    If application stores the SilcClientEntry it must always take
  *    a reference of it by calling silc_client_ref_client function.  The
@@ -114,6 +133,8 @@ struct SilcChannelEntryStruct {
   SilcHashTable user_list;          /* Joined users.  Key to hash table is
                                        SilcClientEntry, context is
                                        SilcChannelUser. */
+  const char *cipher;               /* Current channel cipher algorithm*/
+  const char *hmac;                 /* Current channel HMAC algorithm */
 
   void *context;                    /* Application specific context */
   SilcChannelEntryInternal internal;
@@ -306,8 +327,13 @@ void silc_client_list_free(SilcClient client, SilcClientConnection conn,
  *    completion callback will be called when the client entries has been
  *    found.  After the server returns the client information it is cached
  *    and can be accesses locally at a later time.  The resolving is done
- *    with IDENTIFY command.  The `server' may be NULL.  Returns 0 on
- *    error and the command identifier used with the command otherwise.
+ *    with IDENTIFY command.  The `server' may be NULL.  The server
+ *    associated with the nickname may be in the `nickname' (nick@server).
+ *    The `nickname' may also be a formatted nickname in which case the
+ *    formatting is ignored and the base nickname is used.  If the nickname
+ *    is formatted it must be formatted as defined in SilcClientParams.
+ *    Returns 0 on error and the command identifier used with the command
+ *    otherwise.
  *
  * NOTES
  *
@@ -349,8 +375,13 @@ SilcUInt16 silc_client_get_clients(SilcClient client,
  *    completion callback will be called when the client entries has been
  *    found.  After the server returns the client information it is cached
  *    and can be accesses locally at a later time.  The resolving is done
- *    with WHOIS command.  The `server' may be NULL.  Returns 0 on error,
- *    and the command identifier used with the command otherwise.
+ *    with WHOIS command.  The `server' may be NULL.  The server
+ *    associated with the nickname may be in the `nickname' (nick@server).
+ *    The `nickname' may also be a formatted nickname in which case the
+ *    formatting is ignored and the base nickname is used.  If the nickname
+ *    is formatted it must be formatted as defined in SilcClientParams.
+ *    Returns 0 on error and the command identifier used with the command
+ *    otherwise.
  *
  *    If the `attributes' is non-NULL then the buffer includes Requested
  *    Attributes which can be used to fetch very detailed information
@@ -381,19 +412,20 @@ SilcUInt16 silc_client_get_clients_whois(SilcClient client,
  *    SilcDList silc_client_get_clients_local(SilcClient client,
  *                                            SilcClientConnection conn,
  *                                            const char *nickname,
- *                                            const char *format);
+ *                                            SilcBool return_all);
  *
  * DESCRIPTION
  *
  *    Same as silc_client_get_clients function but does not resolve anything
- *    from the server.  This checks local cache and returns all matching
- *    clients from the local cache.  If none was found this returns NULL.
- *    The `nickname' is the real nickname of the client, and the `format'
- *    is the formatted nickname to find exact match from multiple found
- *    entries.  The format must be same as given in the SilcClientParams
- *    structure to the client library.  If the `format' is NULL all found
- *    clients by `nickname' are returned.  The caller must free the
- *    returned list by silc_client_list_free function.
+ *    from the server.  This checks local cache and returns matching clients
+ *    from the local cache.  If none was found this returns NULL.  The
+ *    `nickname' is the nickname to find and it may be a formatted nickname
+ *    or a base nickname.  If the `return_all' is TRUE this call will return
+ *    all clients matching the `nickname' base.  If it is FALSE this will
+ *    return the exact match if `nickname' is a formatted nickname or the
+ *    first matching nickname if it is not formatted.  The formatted nickname
+ *    must of the format specified in SilcClientParams.  The caller must free
+ *    the returned list by calling silc_client_list_free function.
  *
  * NOTES
  *
@@ -408,7 +440,7 @@ SilcUInt16 silc_client_get_clients_whois(SilcClient client,
 SilcDList silc_client_get_clients_local(SilcClient client,
                                        SilcClientConnection conn,
                                        const char *nickname,
-                                       const char *format);
+                                       SilcBool return_all);
 
 /****f* silcclient/SilcClientAPI/silc_client_get_clients_by_channel
  *
@@ -450,46 +482,6 @@ void silc_client_get_clients_by_channel(SilcClient client,
                                        SilcGetClientCallback completion,
                                        void *context);
 
-/****f* silcclient/SilcClientAPI/silc_client_get_clients_by_list
- *
- * SYNOPSIS
- *
- *    SilcUInt16
- *    silc_client_get_clients_by_list(SilcClient client,
- *                                    SilcClientConnection conn,
- *                                    SilcUInt32 list_count,
- *                                    SilcBuffer client_id_list,
- *                                    SilcGetClientCallback completion,
- *                                    void *context);
- *
- * DESCRIPTION
- *
- *    Gets client entries by the list of client ID's `client_id_list'. This
- *    always resolves those client ID's it doesn't know about from the server.
- *    The `client_id_list' is a list of ID Payloads added one after other.
- *    JOIN command reply and USERS command reply for example returns this sort
- *    of list. The `completion' will be called after the entries are available.
- *    When server returns the client information it will be cached and can be
- *    accessed locally at a later time.  The resolving is done with WHOIS
- *    command.
- *
- *    Returns command identifier for the resolving.  It can be used to attach
- *    a pending command to it, if needed.  Returns 0 when no resolving was
- *    done or wasn't needed (completion is called before this returns).
- *
- * NOTES
- *
- *    If even after resolving some Client ID in the `client_id_list' is
- *    unknown it will be ignored and error is not returned.
- *
- ***/
-SilcUInt16 silc_client_get_clients_by_list(SilcClient client,
-                                          SilcClientConnection conn,
-                                          SilcUInt32 list_count,
-                                          SilcBuffer client_id_list,
-                                          SilcGetClientCallback completion,
-                                          void *context);
-
 /****f* silcclient/SilcClientAPI/silc_client_get_client_by_id
  *
  * SYNOPSIS