A LOT updates. Cannot separate. :)
[silc.git] / apps / silcd / idlist.h
index 66fa094bf6d1badd579859275bfb25faabc3b715..aa444f46f59b78a92ad7f440f83780407bbf4ea2 100644 (file)
@@ -232,7 +232,7 @@ struct SilcClientEntryStruct {
   /* Pointer to the router */
   SilcServerEntry router;
 
-  /* Pointers to channels this client has joined */
+  /* List of channels client has joined to */
   SilcChannelEntry *channel;
   unsigned int channel_count;
 
@@ -258,14 +258,15 @@ struct SilcClientEntryStruct {
 
        Pointer to the client list. This is the client currently on channel.
 
-   int mode
+   unsigned int mode
 
        Client's current mode on the channel.
 
 */
 typedef struct SilcChannelClientEntryStruct {
   SilcClientEntry client;
-  int mode;
+  unsigned int mode;
+  struct SilcChannelClientEntryStruct *next;
 } *SilcChannelClientEntry;
 
 /* 
@@ -290,9 +291,10 @@ typedef struct SilcChannelClientEntryStruct {
 
        Logical name of the channel.
 
-   int mode
+   unsigned int mode
 
-       Current mode of the channel.
+       Current mode of the channel.  See lib/silccore/silcchannel.h for
+       all modes.
 
    SilcChannelID *id
 
@@ -313,6 +315,11 @@ typedef struct SilcChannelClientEntryStruct {
 
        Current topic of the channel.
 
+   char *cipher
+
+       Default cipher of the channel. If this is NULL then server picks
+       the cipher to be used. This can be set at SILC_COMMAND_JOIN.
+
    SilcServerEntry router
 
        This is a pointer to the server list. This is the router server 
@@ -336,14 +343,24 @@ typedef struct SilcChannelClientEntryStruct {
 */
 struct SilcChannelEntryStruct {
   char *channel_name;
-  int mode;
+  unsigned int mode;
   SilcChannelID *id;
   int global_users;
   char *topic;
+  char *cipher;
+
+  /* Data that is related to different channel modes. */
+  struct {
+    unsigned int user_limit;
+    unsigned char *passphrase;
+    unsigned char *ban_list;
+    unsigned char *invite_list;
+    unsigned char *cipher;
+    unsigned int key_len;
+  } mode_data;
 
   /* List of users on channel */
-  SilcChannelClientEntry user_list;
-  unsigned int user_list_count;
+  SilcList user_list;
 
   /* Pointer to the router */
   SilcServerEntry router;
@@ -429,6 +446,11 @@ silc_idlist_add_server(SilcIDList id_list,
                       SilcCipher send_key, SilcCipher receive_key,
                       SilcPKCS pkcs, SilcHmac hmac, 
                       SilcPublicKey public_key, void *connection);
+SilcServerEntry
+silc_idlist_find_server_by_id(SilcIDList id_list, SilcServerID *id);
+SilcServerEntry
+silc_idlist_replace_server_id(SilcIDList id_list, SilcServerID *old_id,
+                             SilcServerID *new_id);
 SilcClientEntry
 silc_idlist_add_client(SilcIDList id_list, char *nickname, char *username,
                       char *userinfo, SilcClientID *id, 
@@ -437,14 +459,20 @@ silc_idlist_add_client(SilcIDList id_list, char *nickname, char *username,
                       SilcPKCS pkcs, SilcHmac hmac, 
                       SilcPublicKey public_key, void *connection);
 void silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry);
+SilcClientEntry *
+silc_idlist_get_clients_by_nickname(SilcIDList id_list, char *nickname,
+                                   char *server, unsigned int *clients_count);
 SilcClientEntry
 silc_idlist_find_client_by_nickname(SilcIDList id_list, char *nickname,
                                    char *server);
 SilcClientEntry
-silc_idlist_find_client_by_hash(SilcIDList id_list, unsigned char *hash,
+silc_idlist_find_client_by_hash(SilcIDList id_list, char *nickname,
                                SilcHash md5hash);
 SilcClientEntry
 silc_idlist_find_client_by_id(SilcIDList id_list, SilcClientID *id);
+SilcClientEntry
+silc_idlist_replace_client_id(SilcIDList id_list, SilcClientID *old_id,
+                             SilcClientID *new_id);
 SilcChannelEntry
 silc_idlist_add_channel(SilcIDList id_list, char *channel_name, int mode,
                        SilcChannelID *id, SilcServerEntry router,