Introduction
Introduction Statistics Contact Development Disclaimer Help
indents - ii - irc it, simple FIFO based irc client
git clone git://git.suckless.org/ii
Log
Files
Refs
README
LICENSE
---
commit c1e10adfad06fd38aada1d10c96447faaf7b51c8
parent 8f78d60c5b30e4e882c2b2740f693d2f70036eb5
Author: [email protected] <unknown>
Date: Tue, 30 Jan 2007 20:35:48 +0100
indents
Diffstat:
M ii.c | 122 ++++++++++++++++-------------…
1 file changed, 61 insertions(+), 61 deletions(-)
---
diff --git a/ii.c b/ii.c
@@ -118,7 +118,7 @@ static void add_channel(char *name)
if(!strcmp(name, c->name))
return; /* already handled */
- fd = open_channel(name);
+ fd = open_channel(name);
if(fd == -1) {
perror("ii: cannot create in channel");
return;
@@ -156,11 +156,11 @@ static void login(char *key, char *fullname)
{
if(key)
snprintf(message, PIPE_BUF,
- "PASS %s\r\nNICK %s\r\nUSER %s localhost %s :…
- nick, nick, host, fullname ? fullname : nick);
+ "PASS %s\r\nNICK %s\r\nUSER %s localhost %s :%…
+ nick, nick, host, fullname ? fullname : nick);
else
snprintf(message, PIPE_BUF, "NICK %s\r\nUSER %s localhost %s :…
- nick, nick, host, fullname ? fullname : nick);
+ nick, nick, host, fullname ? fullname : nick);
write(irc, message, strlen(message)); /* login */
}
@@ -244,54 +244,54 @@ static void proc_channels_input(Channel *c, char *buf)
return;
}
switch (buf[1]) {
- case 'j':
- p = strchr(&buf[3], ' ');
- if(p) *p = 0;
- if((buf[3]=='#')||(buf[3]=='&')||(buf[3]=='+')||(buf[3]=='!')){
- snprintf(message, PIPE_BUF, "JOIN %s\r\n", &buf[3]);
- add_channel(&buf[3]);
- }
- else{
- if(p){
+ case 'j':
+ p = strchr(&buf[3], ' ');
+ if(p) *p = 0;
+ if((buf[3]=='#')||(buf[3]=='&')||(buf[3]=='+')||(buf[3…
+ snprintf(message, PIPE_BUF, "JOIN %s\r\n", &bu…
add_channel(&buf[3]);
- proc_channels_privmsg(&buf[3], p + 1);
- return;
}
- }
- break;
- case 't':
- snprintf(message, PIPE_BUF, "TOPIC %s :%s\r\n", c->name, &buf[…
- break;
- case 'a':
- snprintf(message, PIPE_BUF, "-!- %s is away \"%s\"", nick, &bu…
- print_out(c->name, message);
- if(buf[2] == 0)
- snprintf(message, PIPE_BUF, "AWAY\r\n");
- else
- snprintf(message, PIPE_BUF, "AWAY :%s\r\n", &buf[3]);
- break;
- case 'n':
- snprintf(nick, sizeof(nick),"%s", &buf[3]);
- snprintf(message, PIPE_BUF, "NICK %s\r\n", &buf[3]);
- break;
- case 'l':
- if(c->name[0] == 0)
+ else{
+ if(p){
+ add_channel(&buf[3]);
+ proc_channels_privmsg(&buf[3], p + 1);
+ return;
+ }
+ }
+ break;
+ case 't':
+ snprintf(message, PIPE_BUF, "TOPIC %s :%s\r\n", c->nam…
+ break;
+ case 'a':
+ snprintf(message, PIPE_BUF, "-!- %s is away \"%s\"", n…
+ print_out(c->name, message);
+ if(buf[2] == 0)
+ snprintf(message, PIPE_BUF, "AWAY\r\n");
+ else
+ snprintf(message, PIPE_BUF, "AWAY :%s\r\n", &b…
+ break;
+ case 'n':
+ snprintf(nick, sizeof(nick),"%s", &buf[3]);
+ snprintf(message, PIPE_BUF, "NICK %s\r\n", &buf[3]);
+ break;
+ case 'l':
+ if(c->name[0] == 0)
+ return;
+ if(buf[2] == ' ')
+ snprintf(message, PIPE_BUF, "PART %s :%s\r\n",…
+ else
+ snprintf(message, PIPE_BUF,
+ "PART %s :ii - 500SLOC are too…
+ write(irc, message, strlen(message));
+ close(c->fd);
+ create_filepath(infile, sizeof(infile), c->name, "in");
+ unlink(infile);
+ rm_channel(c);
return;
- if(buf[2] == ' ')
- snprintf(message, PIPE_BUF, "PART %s :%s\r\n", c->name…
- else
- snprintf(message, PIPE_BUF,
- "PART %s :ii - 500SLOC are too much\r…
- write(irc, message, strlen(message));
- close(c->fd);
- create_filepath(infile, sizeof(infile), c->name, "in");
- unlink(infile);
- rm_channel(c);
- return;
- break;
- default:
- snprintf(message, PIPE_BUF, "%s\r\n", &buf[1]);
- break;
+ break;
+ default:
+ snprintf(message, PIPE_BUF, "%s\r\n", &buf[1]);
+ break;
}
write(irc, message, strlen(message));
}
@@ -316,7 +316,7 @@ static void proc_server_cmd(char *buf)
or NUL or CR or LF, the first of which may not be ':'>
<trailing> ::= <Any, possibly *empty*, sequence of octets not inclu…
<crlf> ::= CR LF
- */
+ */
if(buf[0] == ':') { /* check prefix */
if (!(p = strchr(buf, ' '))) return;
*p = 0;
@@ -356,8 +356,8 @@ static void proc_server_cmd(char *buf)
else if(!strncmp("JOIN", argv[TOK_CMD], 5)) {
if(argv[TOK_TEXT]!=nil){
p = strchr(argv[TOK_TEXT], ' ');
- if(p)
- *p = 0;
+ if(p)
+ *p = 0;
}
argv[TOK_CHAN] = argv[TOK_TEXT];
snprintf(message, PIPE_BUF, "-!- %s(%s) has joined %s", argv[T…
@@ -451,8 +451,8 @@ static void run()
exit(EXIT_FAILURE);
} else if(r == 0) {
if(time(NULL) - last_response >= PING_TIMEOUT) {
- print_out(NULL, "-!- ii shutting down: pin…
- exit(EXIT_FAILURE);
+ print_out(NULL, "-!- ii shutting down: ping ti…
+ exit(EXIT_FAILURE);
}
write(irc, ping_msg, strlen(ping_msg));
continue;
@@ -488,13 +488,13 @@ int main(int argc, char *argv[])
for(i = 1; (i + 1 < argc) && (argv[i][0] == '-'); i++) {
switch (argv[i][1]) {
- case 'i': snprintf(prefix,sizeof(prefix),"%s", argv[++i]); bre…
- case 's': host = argv[++i]; break;
- case 'p': port = atoi(argv[++i]); break;
- case 'n': snprintf(nick,sizeof(nick),"%s", argv[++i]); break;
- case 'k': key = argv[++i]; break;
- case 'f': fullname = argv[++i]; break;
- default: usage(); break;
+ case 'i': snprintf(prefix,sizeof(prefix),"%s", argv[++…
+ case 's': host = argv[++i]; break;
+ case 'p': port = atoi(argv[++i]); break;
+ case 'n': snprintf(nick,sizeof(nick),"%s", argv[++i]);…
+ case 'k': key = argv[++i]; break;
+ case 'f': fullname = argv[++i]; break;
+ default: usage(); break;
}
}
irc = tcpopen(port);
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.