changeset: 572:4b094aa66267
tag: tip
user: Evan Gates <evan.gates_AT_gmail.com>
date: Wed Jun 30 14:52:35 2010 -0700
files: tools.suckless.org/ii/patches/ii-1.4-joinuser.diff tools.suckless.org/ii/patches/joinuser.md
description:
added joinuser patch for ii (ii-1.4-joinuser.diff)
diff -r 8b85330e0ed6 -r 4b094aa66267 tools.suckless.org/ii/patches/ii-1.4-joinuser.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools.suckless.org/ii/patches/ii-1.4-joinuser.diff Wed Jun 30 14:52:35 2010 -0700
_AT_@ -0,0 +1,54 @@
+diff -r d93eaacde742 ii.c
+--- a/ii.c Fri Jun 25 10:55:05 2010 +0200
++++ b/ii.c Wed Jun 30 14:44:35 2010 -0700
+_AT_@ -105,6 +105,7 @@
+ return open(infile, O_RDONLY | O_NONBLOCK, 0);
+ }
+
++static void print_out(char *channel, char *buf); // needs to be declared
+ static void add_channel(char *name) {
+ Channel *c;
+ int fd;
+_AT_@ -130,6 +131,12 @@
+ }
+ c->fd = fd;
+ c->name = strdup(name);
++
++ if(!((name[0]=='#')||(name[0]=='&')||(name[0]=='+')||(name[0]=='!'))) {
++ char msg[128];
++ snprintf(msg, PIPE_BUF, "-!- %s has joined %s", nick, name);
++ print_out(name, msg);
++ }
+ }
+
+ static void rm_channel(Channel *c) {
+_AT_@ -211,6 +218,7 @@
+ if(strstr(buf, server)) channel="";
+ create_filepath(outfile, sizeof(outfile), channel, "out");
+ if(!(out = fopen(outfile, "a"))) return;
++ if(channel && channel[0]) add_channel(channel);
+
+ strftime(buft, sizeof(buft), "%F %R", localtime(&t));
+ fprintf(out, "%s %s\n", buft, buf);
+_AT_@ -237,17 +245,14 @@
+ case 'j':
+ p = strchr(&buf[3], ' ');
+ if(p) *p = 0;
++ add_channel(&buf[3]);
+ if((buf[3]=='#')||(buf[3]=='&')||(buf[3]=='+')||(buf[3]=='!')){
+ if(p) snprintf(message, PIPE_BUF, "JOIN %s %s\r\n", &buf[3], p + 1); /* password protected channel */
+ else snprintf(message, PIPE_BUF, "JOIN %s\r\n", &buf[3]);
+- add_channel(&buf[3]);
+ }
+- else {
+- if(p){
+- add_channel(&buf[3]);
+- proc_channels_privmsg(&buf[3], p + 1);
+- return;
+- }
++ else if(p) {
++ proc_channels_privmsg(&buf[3], p + 1);
++ return;
+ }
+ break;
+ case 't':
diff -r 8b85330e0ed6 -r 4b094aa66267 tools.suckless.org/ii/patches/joinuser.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools.suckless.org/ii/patches/joinuser.md Wed Jun 30 14:52:35 2010 -0700
_AT_@ -0,0 +1,21 @@
+JOINUSER
+========
+
+Description
+-----------
+
+By default to PRIVMSG a user you need to `/j user message`, this patch makes `message` optional.
+It also displays "-!- yournick has joined user" prior to any messages both when you `/j user` and
+when a user messages you, and incorporates the [autojoin](
http://tools.suckless.org/ii/patches/autojoin)
+patch, so you do not need to `/j user` first to talk to someone who has already messaged you.
+
+Download
+--------
+
+* [ii-1.4-joinuser.diff](ii-1.4-joinuser.diff)
+
+Author
+------
+
+* Bob Lowry (bobertlo) <[bobertlo_AT_gmail.com](mailto:bobertlo_AT_gmail.com)>
+* Evan Gates (emg) <[evan.gates_AT_gmail.com](mailto:evan.gates_AT_gmail.com)>
Received on Wed Jun 30 2010 - 23:52:16 CEST