]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Added clean_key() function. We are trusting ircu so we don't actually use it on...
authorsplidge <redacted>
Mon, 17 Mar 2008 12:36:38 +0000 (12:36 +0000)
committersplidge <redacted>
Mon, 17 Mar 2008 12:36:38 +0000 (12:36 +0000)
channel/channel.c
channel/channel.h

index 71d8b0281ace5d561a8a5fd17d6d5ee67e16eda8..6531ce89f026a7fd856dee7650c11a306aa27f1f 100644 (file)
@@ -432,3 +432,18 @@ unsigned int countuniquehosts(channel *cp) {
   return count;
 }
 
+/*
+ * clean_key: returns a "cleaned" version of the key like ircu does.
+ *
+ * Note that s is a signed char, so we are basically allowing everything from 33-127 except : or ,
+ *
+ * Unlike ircu we don't check against KEYLEN here, this is done elsewhere.
+ */
+void clean_key(char *key) {
+  while (*key) {
+    if (*key<=32 || *key==':' || *key==',') {
+      *key=0;
+      return;
+    }
+  }
+}
index 952a6ae26de461a3e9c1e245c9e833c7f8f7f6a2..846cc2729e128e3c6803923860abab34a7461994 100644 (file)
@@ -138,6 +138,7 @@ void removechannelfromhash(channel *cp);
 void addordelnick(int hooknum, void *arg);
 void onconnect(int hooknum, void *arg);
 unsigned int countuniquehosts(channel *cp);
+void clean_key(char *s);
 
 /* functions from channelhandlers.c */
 int handleburstmsg(void *source, int cargc, char **cargv);