This commit is contained in:
Your Name 2024-03-04 17:48:15 +03:00
parent 6a7a61d6ae
commit 3b8975a21c

16
main.c
View File

@ -2,10 +2,15 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <sys/socket.h> #include <string.h>
#include <time.h> #include <time.h>
#include <sys/socket.h>
#include "irc.h" #include "irc.h"
#ifdef ENABLE_SSL
#include <openssl/err.h>
#endif
IRCC_client client; IRCC_client client;
char *dir = "./"; char *dir = "./";
char *ext = ".txt"; char *ext = ".txt";
@ -23,6 +28,7 @@ void die(const char *msg) {
void sig_handler(int sig) { void sig_handler(int sig) {
fprintf(stderr, "history: recived signal: %d\n", sig); fprintf(stderr, "history: recived signal: %d\n", sig);
IRCC_close(&client); IRCC_close(&client);
exit(0); exit(0);
} }
@ -110,9 +116,10 @@ int main(int argc, char **argv) {
die("connection refused"); die("connection refused");
if (usessl) { if (usessl) {
int irc_errno = 0; #ifdef ENABLE_SSL
if (IRCC_initssl(&client, &irc_errno) == IRCC_ERROR) if (IRCC_initssl(&client) == IRCC_ERROR)
die(IRCC_errno[irc_errno]); die(ERR_error_string(ERR_get_error(), NULL));
#endif
} }
//Register and skip motd //Register and skip motd
@ -146,4 +153,3 @@ int main(int argc, char **argv) {
WriteToFile(); WriteToFile();
} }
} }