fixed
This commit is contained in:
parent
f9cc013c8d
commit
8d63329fda
4
README
4
README
@ -4,6 +4,10 @@
|
|||||||
md5 irc.c c43a8faf4ad199a30a1148b847867022
|
md5 irc.c c43a8faf4ad199a30a1148b847867022
|
||||||
md5 irc.h bd6a06cb02d75da9896233db6ea20cd8
|
md5 irc.h bd6a06cb02d75da9896233db6ea20cd8
|
||||||
|
|
||||||
|
> сборка
|
||||||
|
git clone https://git.macaw.me/8nl/irclibs
|
||||||
|
cc -I irclibs/C irclibs/C/irc.c main.c -lssl -lcrypto
|
||||||
|
|
||||||
> gemini://any-key.press/tt/welcome.gmi
|
> gemini://any-key.press/tt/welcome.gmi
|
||||||
Сделано в соответствии с духом Тривиальных Технологий
|
Сделано в соответствии с духом Тривиальных Технологий
|
||||||
|
|
||||||
|
33
main.c
33
main.c
@ -116,37 +116,24 @@ void run_gemini(IRCC_client *client) {
|
|||||||
if (SSL_connect(gem_cfg.ssl) < 1)
|
if (SSL_connect(gem_cfg.ssl) < 1)
|
||||||
goto RG_CLOSE_TLS;
|
goto RG_CLOSE_TLS;
|
||||||
|
|
||||||
/* Send response */
|
/* Send request */
|
||||||
ssize_t size = snprintf(domain, sizeof(domain), "gemini://%s\r\n", uri);
|
ssize_t size = snprintf(domain, sizeof(domain), "gemini://%s\r\n", uri);
|
||||||
if (SSL_write(gem_cfg.ssl, domain, size) < 1)
|
if (SSL_write(gem_cfg.ssl, domain, size) < 1)
|
||||||
goto RG_CLOSE_TLS;
|
goto RG_CLOSE_TLS;
|
||||||
|
|
||||||
bool exit_flag = 0;
|
/* Send response to the irc user */
|
||||||
while (1) {
|
char buf[256];
|
||||||
char buf[128];
|
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
|
|
||||||
/* Read line */
|
|
||||||
while ((size = SSL_read(gem_cfg.ssl, p, 1)) > 0) {
|
while ((size = SSL_read(gem_cfg.ssl, p, 1)) > 0) {
|
||||||
if (*p == '\n' || p == buf + sizeof(buf)) {
|
if (*p == '\n') {
|
||||||
*p = '\0';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size <= 0) {
|
|
||||||
if (exit_flag)
|
|
||||||
break;
|
|
||||||
|
|
||||||
exit_flag = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
p = buf;
|
||||||
IRCC_send(client, nick, buf);
|
IRCC_send(client, nick, buf);
|
||||||
exit_flag = 0;
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -217,7 +204,7 @@ int main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("gem2irc - simple bridge between irc and gemini\ngem2irc -[n:p:h:tVD] [e.p CHANNEL1:PASSWORD CHANNEL2...]\n\t-n NICK\tdefault: %s\n\t-h HOST\tdefault: %s\n\t-p PORT\tdefault: %d\n\t-t Use ssl\tdefault: %s\n\t-D Print raw messages\n\t-V Version\n", cfg.nick, cfg.ip, cfg.port, (cfg.use_ssl) ? "true" : "false");
|
printf("gem2irc - simple bridge between irc and gemini\ngem2irc -[n:p:h:tVD] [e.p CHANNEL1:PASSWORD CHANNEL2...]\n\t-n NICK default: %s\n\t-h HOST default: %s\n\t-p PORT default: %d\n\t-t Use ssl default: %s\n\t-D Print raw messages\n\t-V Version\n", cfg.nick, cfg.ip, cfg.port, (cfg.use_ssl) ? "true" : "false");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user