fixed
This commit is contained in:
parent
18278e6d6c
commit
65de41ff41
18
C/irc.c
18
C/irc.c
@ -91,14 +91,6 @@ int IRCC_recv(IRCC_client *irc) {
|
||||
if (msg_size == 0 || msg_size == -1)
|
||||
return IRCC_DISCONNECTED;
|
||||
|
||||
else if (!strncmp(irc->irc_raw, "PING", 4)) {
|
||||
*(strchr(irc->irc_raw, 'I')) = 'O';
|
||||
if (IRCC_usend(irc, strlen(irc->irc_raw)) == -1)
|
||||
return IRCC_ERROR;
|
||||
|
||||
return IRCC_PING;
|
||||
}
|
||||
|
||||
return IRCC_SUCCESS;
|
||||
}
|
||||
|
||||
@ -107,11 +99,18 @@ int IRCC_parse(IRCC_client *irc) {
|
||||
irc->irc_msg = NULL;
|
||||
irc->irc_nick = NULL;
|
||||
|
||||
if (!strncmp(irc->irc_raw, "PING", 4)) {
|
||||
*(strchr(irc->irc_raw, 'I')) = 'O';
|
||||
if (IRCC_usend(irc, strlen(irc->irc_raw)) == -1)
|
||||
return IRCC_ERROR;
|
||||
|
||||
return IRCC_PING;
|
||||
}
|
||||
|
||||
//Check end of motd
|
||||
if (strstr(irc->irc_raw, "PRIVMSG ") == NULL && strstr(irc->irc_raw, "MOTD"))
|
||||
return IRCC_CONNECTED;
|
||||
|
||||
//Other
|
||||
else if (strstr(irc->irc_raw, "PRIVMSG ")) {
|
||||
IRCC_parse_msg(strstr(irc->irc_raw, "PRIVMSG "), irc);
|
||||
return IRCC_PRIVMSG;
|
||||
@ -235,3 +234,4 @@ void IRCC_close(IRCC_client *irc) {
|
||||
SSL_CTX_free(irc->irc_sslctx);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
2
C/main.c
2
C/main.c
@ -48,7 +48,7 @@ void recvinfo(void) {
|
||||
else if (client.irc_nick != NULL && irc_status == IRCC_JOIN)
|
||||
printf("[>] %s\n", client.irc_nick);
|
||||
|
||||
else if (client.irc_nick != NULL && irc_status == IRCC_PART)
|
||||
else if (client.irc_nick != NULL && irc_status == IRCC_QUIT)
|
||||
printf("[<] %s\n", client.irc_nick);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user