fixed
This commit is contained in:
parent
de4223170b
commit
332c0ff43b
3 changed files with 31 additions and 31 deletions
19
C/main.c
19
C/main.c
|
@ -2,13 +2,14 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include "irc.h"
|
||||
|
||||
//Config
|
||||
#define HOST "irc.rizon.net"
|
||||
#define PORT 6697
|
||||
#define NICK "tester134"
|
||||
char *channels[] = {"#testssl"};
|
||||
char *channels[] = {"#test"};
|
||||
|
||||
#define CHECK_NULL() (client.irc_nick != NULL && client.irc_channel != NULL && client.irc_msg != NULL)
|
||||
IRCC_client client;
|
||||
|
@ -19,6 +20,13 @@ void die(const char *msg) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
void handler(int sig) {
|
||||
(void)sig;
|
||||
|
||||
IRCC_close(&client);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void recvinfo(void) {
|
||||
while (1) {
|
||||
unsigned int irc_status = IRCC_recv(&client);
|
||||
|
@ -46,13 +54,16 @@ void recvinfo(void) {
|
|||
}
|
||||
|
||||
int main(void) {
|
||||
signal(SIGINT, handler);
|
||||
|
||||
int status = IRCC_connect(&client, HOST, PORT);
|
||||
if (status == IRCC_ERROR)
|
||||
die("Conn refused");
|
||||
|
||||
int ie = 0;
|
||||
if (IRCC_initssl(&client, &ie) == IRCC_ERROR)
|
||||
die(IRCC_errno[ie]);
|
||||
if (IRCC_initssl(&client) == IRCC_ERROR) {
|
||||
IRCC_close(&client);
|
||||
die("ssl error");
|
||||
}
|
||||
|
||||
//Register and skip motd
|
||||
IRCC_register(&client, NICK);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue