summaryrefslogtreecommitdiff
path: root/libirc/examples
diff options
context:
space:
mode:
authorepochqwert <epoch@53flpnlls43fcguy.onion>2015-03-12 22:55:04 -0500
committerepochqwert <epoch@53flpnlls43fcguy.onion>2015-03-12 22:55:04 -0500
commit9429905cb75e36107df9c0b44a3dd9293520f4f2 (patch)
tree4d41b786580f59478772f93e665ab1d81edd83e1 /libirc/examples
parentecb12efc5ce737532402167679c0f7ffb22c495b (diff)
downloadsegfault-9429905cb75e36107df9c0b44a3dd9293520f4f2.tar.gz
segfault-9429905cb75e36107df9c0b44a3dd9293520f4f2.zip
an upgrade to link.c to allow keys in channels.
segfault fixed to set tailf[i].to=0 in more cases so it can be tested. don't remember what changes were made to libirc.c
Diffstat (limited to 'libirc/examples')
-rw-r--r--libirc/examples/link.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libirc/examples/link.c b/libirc/examples/link.c
index 0c9e7dd..c175595 100644
--- a/libirc/examples/link.c
+++ b/libirc/examples/link.c
@@ -40,6 +40,7 @@ void message_handler(int fd,char *from,struct user *user,char *line) {
void line_handler(int fd,char *line) {//this should be built into the libary?
char *s=line,*t=0,*u=0;
+ char *temp;
char tmp[512];
struct user *user=malloc(sizeof(struct user));
user->nick=0;
@@ -81,6 +82,8 @@ void line_handler(int fd,char *line) {//this should be built into the libary?
if(!user->user && s) {
if(!strcmp(s,"004")) {
snprintf(tmp,sizeof(tmp)-1,"JOIN %s\r\n",chans[fdtoi(fd)]);
+ temp=strchr(chans[fdtoi(fd)],' ');
+ if(temp) *temp=0;
mywrite(fd,tmp);
}
}
@@ -93,7 +96,14 @@ void line_handler(int fd,char *line) {//this should be built into the libary?
if(!strcmp(s,"JOIN")) {
snprintf(tmp,sizeof(tmp)-1,"%cACTION %s has joined %s%c",1,user->nick,t+(*t==':'),1);
privmsg_others(fd,tmp);
- //send a join message to the other end.
+ }
+ if(!strcmp(s,"PART")) {
+ snprintf(tmp,sizeof(tmp)-1,"%cACTION %s has parted %s%c",1,user->nick,t+(*t==':'),1);
+ privmsg_others(fd,tmp);
+ }
+ if(!strcmp(s,"QUIT")) {
+ snprintf(tmp,sizeof(tmp)-1,"%cACTION %s has quited %s%c",1,user->nick,t+(*t==':'),1);
+ privmsg_others(fd,tmp);
}
}
free(user);