Hey, at the moment, i've written a console program which currently connects to an IRC server and idles there. Here's the while loop i use:
Code:
while (1) {
::WSAWaitForMultipleEvents(1, &wsaevent,FALSE, INFINITE, FALSE);
::WSAEnumNetworkEvents(temp,wsaevent,&hProcessEvent);
if ((hProcessEvent.lNetworkEvents & FD_READ) && (hProcessEvent.iErrorCode[FD_READ_BIT] == 0)) {
if (online) {
// Connected to server and received data.. send it to the OnRecv() function
OnRecv();
} else {
break;
}
}
}
and the OnRecv() function:
Code:
int IRCconnection::OnRecv() {
//When incoming data detected.. do this
string data;
data = readline(); // Retreive line at a time
checkreg(); // Check if registered
checkforping(data); // See if the data received is from a ping request
}
Now at this same time, I would like for there to be an interface via this console program. ie an options menu....
Code:
1) Reload Database
2) Change to next server
3) Change Nickname
etc...
Now i was just wondering, if I created a display function, would the display be useable without disturbing the IRC connection. At any time it may respond to both console and IRC input.
IRC via triggers, e.g. !slap and console via the menu. If you could provide any code to help me create a menu that wouldnt disturb IRC functions then that would be great.
Thanks