Permalink
Browse files

/ignore -l: lists ignores

  • Loading branch information...
Sound and Fury
Sound and Fury committed Sep 1, 2010
1 parent a43b8e6 commit 5ed2685445df9a865feedea40f10a48a4940e192
Showing with 55 additions and 0 deletions.
  1. +2 −0 Makefile
  2. +5 −0 input.c
  3. +45 −0 names.c
  4. +3 −0 names.h
View
@@ -49,6 +49,8 @@ config.o: config.c config.h bits.h colour.h text.h version.h
input.o: input.c input.h ttyesc.h names.h buffer.h irc.h
+names.o: names.c names.h buffer.h
+
c_init.c: colour.d c_init.awk
$(AWK) -f c_init.awk colour.d > c_init.c
View
@@ -922,6 +922,11 @@ int cmd_handle(char *inp, char **qmsg, fd_set *master, int *fdmax) // old state=
{
pms=true;
}
+ else if(strcmp(arg, "-l")==0)
+ {
+ i_list(cbuf);
+ break;
+ }
else if(strcmp(arg, "--")==0)
{
arg=strtok(NULL, "");
View
45 names.c
@@ -128,3 +128,48 @@ int i_cull(name ** list, char *nm)
}
return(rv);
}
+
+void i_list(int b)
+{
+ int count=0;
+ if(bufs[cbuf].type==CHANNEL)
+ {
+ name *curr=bufs[cbuf].ilist;
+ while(curr)
+ {
+ name *next=curr->next;
+ char tag[20];
+ sprintf(tag, "/ignore -l: C%s%s\t", curr->pms?"p":"", curr->icase?"i":"");
+ w_buf_print(cbuf, c_status, curr->data, tag);
+ count++;
+ curr=next;
+ }
+ }
+ if(bufs[cbuf].server)
+ {
+ name *curr=bufs[bufs[cbuf].server].ilist;
+ while(curr)
+ {
+ name *next=curr->next;
+ char tag[20];
+ sprintf(tag, "/ignore -l: S%s%s\t", curr->pms?"p":"", curr->icase?"i":"");
+ w_buf_print(cbuf, c_status, curr->data, tag);
+ count++;
+ curr=next;
+ }
+ }
+ name *curr=bufs[0].ilist;
+ while(curr)
+ {
+ name *next=curr->next;
+ char tag[20];
+ sprintf(tag, "/ignore -l: *%s%s\t", curr->pms?"p":"", curr->icase?"i":"");
+ w_buf_print(cbuf, c_status, curr->data, tag);
+ count++;
+ curr=next;
+ }
+ if(!count)
+ {
+ w_buf_print(cbuf, c_status, "No active ignores for this view.", "/ignore -l: ");
+ }
+}
View
@@ -24,9 +24,12 @@ typedef struct _name
}
name;
+#include "buffer.h"
+
name * n_add(name ** list, char *data); // returns pointer to the added name (which should also be the new value of *list). Calls n_cull() first
int n_cull(name ** list, char *data); // returns number of instances culled
void n_free(name * list);
int i_match(name * list, char *nm, bool pm); // returns number of matches
int i_cull(name ** list, char *nm); // returns number of instances culled
+void i_list(int b);

0 comments on commit 5ed2685

Please sign in to comment.