get default value if channel_getop or channel_getvoice is NULL
[NeonServV5.git] / ClientSocket.h
index 3fff1e87f66e4f062621d4779ebf2158a0b7398a..494505b15451d9530f0d75184232e029c309123e 100644 (file)
@@ -3,13 +3,15 @@
 
 #include "main.h"
 
-#define SOCKET_FLAG_DEAD 0x01;
-#define SOCKET_FLAG_CONNECTED 0x02;
-#define SOCKET_FLAG_READY 0x04;
+#define SOCKET_FLAG_DEAD      0x01
+#define SOCKET_FLAG_CONNECTED 0x02
+#define SOCKET_FLAG_READY     0x04
+#define SOCKET_FLAG_PREFERRED  0x08 /* prefered bot to send datas to the IRC World (NOTICE's WHO's etc pp) */
 
 #define BUF_SIZ 512
 
 struct UserNode;
+struct trigger_cache;
 
 struct ClientSocket {
     int sock;
@@ -20,14 +22,20 @@ struct ClientSocket {
     int port;
     char *pass;
     struct UserNode *user;
+       
+       int botid : 16;
+    int clientid : 16;
     
     struct ClientSocket *next;
-}
+};
 
-struct ClientSocket* create_socket(char *host, int *port, char *pass, struct UserNode *user);
-int connect_socket(struct ClientSocket *socket);
-int close_socket(struct ClientSocket *socket);
-int write_socket(struct ClientSocket *socket, char* msg, int len);
-void socket_loop(int timeout);
+struct ClientSocket* create_socket(char *host, int port, char *pass, struct UserNode *user);
+int connect_socket(struct ClientSocket *client);
+int close_socket(struct ClientSocket *client);
+int write_socket(struct ClientSocket *client, char* msg, int len);
+void socket_loop(int timeout_seconds);
+void putsock(struct ClientSocket *client, const char *text, ...) PRINTF_LIKE(2, 3);
+struct ClientSocket* getBots(int flags, struct ClientSocket* last_bot);
+void free_sockets();
 
 #endif
\ No newline at end of file