Fixed nickname parsing with WHOIS command to accept formatted
[silc.git] / lib / silcclient / silcclient.h
index 4d3fc3a05628b15925bbf648ff88bd68e65400c7..6de071253e902543cde3304f802b219dfb12384a 100644 (file)
  * employ concurrency control if the callbacks need to access shared data
  * in the application.  Messages are also received in that thread.
  *
- * 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_H
@@ -681,20 +672,18 @@ typedef struct {
      Following format types are available:
 
      %n  nickname      - the real nickname returned by the server (mandatory)
+     %a  number        - ascending number in case there are several
+                         same nicknames (fe. nick#2 and nick#3)
      %h  hostname      - the stripped hostname of the client
      %H  full hostname - the full hostname of the client
-     %s  server name   - the server name the client is connected
-     %S  full server   - the full server name the client is connected
-     %a  number        - ascending number in case there are several
-                         same nicknames (fe. nick@host and nick@host2)
 
-     Example format strings: "%n@%h%a"   (fe. nick@host, nick@host2)
-                             "%a!%n@%s"  (fe. nick@server, 2!nick@server)
-                            "%n@%H"     (fe. nick@host.domain.com)
+     Example format strings: "%n#%a"     (fe. nick#2, nick#3)
+                             "%n@%h%a"   (fe. nick@host, nick@host2)
+                             "%a!%n@%h"  (fe. nick@host, 2!nick@host)
 
      Note that there must always be some separator characters around '%n'
      format.  It is not possible to put format characters before or after
-     '%n' without separators (such ash '@').  Also note that the separator
+     '%n' without separators (such ash '#').  Also note that the separator
      character should be a character that cannot be part of normal nickname.
   */
   char nickname_format[32];
@@ -2008,7 +1997,7 @@ SilcBool silc_client_set_away_message(SilcClient client,
  *
  *    The SILC_CLIENT_FILE_MONITOR_DISCONNECT will be called if remote
  *    disconnects the session connection.  The silc_client_file_close must
- *    be called when this status is received.  The session is over when 
+ *    be called when this status is received.  The session is over when
  *    this is received.
  *
  *    The SILC_CLIENLT_FILE_MONITOR_ERROR is called in case some error
@@ -2418,6 +2407,30 @@ SilcClientEntry silc_client_nickname_format(SilcClient client,
                                            SilcClientEntry client_entry,
                                            SilcBool priority);
 
+/****f* silcclient/SilcClientAPI/silc_client_nickname_parse
+ *
+ * SYNOPSIS
+ *
+ *    SilcBool silc_client_nickname_parse(SilcClient client,
+ *                                        SilcClientConnection conn,
+ *                                        char *nickname,
+ *                                        char **ret_nick);
+ *
+ * DESCRIPTION
+ *
+ *    Parses the `nickname' according to the format string given in the
+ *    SilcClientParams.  Returns the parsed nickname into the `ret_nick'.
+ *    The caller must free the returned pointer.  Returns FALSE if error
+ *    occurred during parsing.  Returns TRUE if the nickname was parsed,
+ *    it was not formatted or if the format string has not been specified
+ *    in SilcClientParams.
+ *
+ ***/
+SilcBool silc_client_nickname_parse(SilcClient client,
+                                   SilcClientConnection conn,
+                                   char *nickname,
+                                   char **ret_nick);
+
 #ifdef __cplusplus
 }
 #endif