Upload files to "C"

This commit is contained in:
8nl 2024-01-23 16:43:32 +00:00
parent 6a1d2cf850
commit b4825a3fb7
3 changed files with 93 additions and 91 deletions

View file

@ -5,13 +5,13 @@
#include "irc.h"
//Config
#define HOST "irc.rizon.net"
#define HOST "192.168.0.184"
#define PORT 6667
#define NICK "tester134"
char *channels[] = {"#hp"};
char *channels[] = {"#test"};
#define CHECK_NULL() (client.nick != NULL && client.channel != NULL && client.msg != NULL)
#define CHECK_NULL() (client.irc_nick != NULL && client.irc_channel != NULL && client.irc_msg != NULL)
IRCC_client client;
void die(char *msg) {
@ -26,21 +26,23 @@ void recvinfo(void) {
if (irc_status == IRCC_DISCONNECTED)
die("Disconnected");
irc_status = IRCC_parse(&client);
//Print
if (CHECK_NULL() && irc_status == IRCC_PRIVMSG)
printf("[%s %s] %s\n", client.channel, client.nick, client.msg);
printf("[%s %s] %s\n", client.irc_channel, client.irc_nick, client.irc_msg);
else if (CHECK_NULL() && irc_status == IRCC_NICK)
printf("[N] %s is know as %s\n", client.nick, client.msg);
else if (client.irc_nick != NULL && client.irc_msg != NULL && irc_status == IRCC_NICK)
printf("[N] %s is know as %s\n", client.irc_nick, client.irc_msg);
else if (CHECK_NULL() && irc_status == IRCC_TOPIC)
printf("[T] %s\n", client.msg);
printf("[T] %s\n", client.irc_msg);
else if (client.nick != NULL && irc_status == IRCC_JOIN)
printf("[>] %s\n", client.nick);
else if (client.irc_nick != NULL && irc_status == IRCC_JOIN)
printf("[>] %s\n", client.irc_nick);
else if (client.nick != NULL && irc_status == IRCC_PART)
printf("[<] %s\n", client.nick);
else if (client.irc_nick != NULL && irc_status == IRCC_PART)
printf("[<] %s\n", client.irc_nick);
}
}