That library is going to be a concurrent IRC client library providing the basics most IRC clients need: Lag management, rate limiting, sending pongs and so on.
There is some chaos in its code, but that code can be used as a basis for this. However, it's also okay to start from scratch and later connect it with that code.
Here's the basic idea:
You fill a record of IRC server and other settings, and you pass them to a function that launches, in a new thread, a connection manager. It gives you an abstract value you can use to send commands like "disconnect" or "reconnect". That connection manager thread runs the following loop:
Try to connect to IRC server
If timeout, jump to 1 trying again with an increased timeout
If success, launch threads for listening on the socket, lag management and rate limiting
Listen on the event queue (which is basically all the IRC messages that aren't handled automatically such as PINGs, and maybe some extra processing and internal command like "disconnect" or "reconnect" issued by the user) until network error occurs, or max lag reached, or user command given
Stop all the helper threads and disconnect from server
If asked to stop, end here
If asked to reconnect, jump to 1
That library is going to be a concurrent IRC client library providing the basics most IRC clients need: Lag management, rate limiting, sending pongs and so on.
There is some chaos in its code, but that code can be used as a basis for this. However, it's also okay to start from scratch and later connect it with that code.
Here's the basic idea:
You fill a record of IRC server and other settings, and you pass them to a function that launches, in a new thread, a connection manager. It gives you an abstract value you can use to send commands like "disconnect" or "reconnect". That connection manager thread runs the following loop:
1. Try to connect to IRC server
2. If timeout, jump to 1 trying again with an increased timeout
3. If success, launch threads for listening on the socket, lag management and rate limiting
4. Listen on the event queue (which is basically all the IRC messages that aren't handled automatically such as PINGs, and maybe some extra processing and internal command like "disconnect" or "reconnect" issued by the user) until network error occurs, or max lag reached, or user command given
5. Stop all the helper threads and disconnect from server
6. If asked to stop, end here
7. If asked to reconnect, jump to 1
That library is going to be a concurrent IRC client library providing the basics most IRC clients need: Lag management, rate limiting, sending pongs and so on.
There is some chaos in its code, but that code can be used as a basis for this. However, it's also okay to start from scratch and later connect it with that code.
Here's the basic idea:
You fill a record of IRC server and other settings, and you pass them to a function that launches, in a new thread, a connection manager. It gives you an abstract value you can use to send commands like "disconnect" or "reconnect". That connection manager thread runs the following loop: