added IRC Client and RAW pass-through
[TransparentIRC.git] / src / IOHandler.c
index 375bcea86e3a20e8196114a33cbf6f3bbdd47df2..1843accb8f9cde95a5b25daab8827ce8677b3c10 100644 (file)
@@ -106,7 +106,7 @@ struct IODescriptor *iohandler_timer(struct timeval timeout, iohandler_callback
     return descriptor;
 }
 
-struct IODescriptor *iohandler_connect(const char *hostname, unsigned int port, const char *bindhost, iohandler_callback *callback) {
+struct IODescriptor *iohandler_connect(const char *hostname, unsigned int port, int ssl, const char *bindhost, iohandler_callback *callback) {
     //non-blocking connect
     int sockfd;
     struct addrinfo hints, *res, *freeres;
@@ -216,7 +216,7 @@ struct IODescriptor *iohandler_connect(const char *hostname, unsigned int port,
     return descriptor;
 }
 
-struct IODescriptor *iohandler_listen(const char *hostname, unsigned int port, iohandler_callback *callback) {
+struct IODescriptor *iohandler_listen(const char *hostname, unsigned int port, int ssl, iohandler_callback *callback) {
     int sockfd;
     struct addrinfo hints, *res, *freeres;
     struct sockaddr_in *ip4 = NULL;
@@ -434,8 +434,10 @@ void iohandler_events(struct IODescriptor *iofd, int readable, int writeable) {
                         if(used_bytes) {
                             if(used_bytes == iofd->readbuf.bufpos)
                                 iofd->readbuf.bufpos = 0;
-                            else
+                            else {
                                 memmove(iofd->readbuf.buffer, iofd->readbuf.buffer + used_bytes, iofd->readbuf.bufpos - used_bytes);
+                                iofd->readbuf.bufpos -= used_bytes;
+                            }
                         }
                         callback_event.type = IOEVENT_IGNORE;
                     }