]> jfr.im git - irc/UndernetIRC/gnuworld.git/commitdiff
Support for , for multiple invites
authorMrBean <redacted>
Fri, 20 Apr 2012 18:23:50 +0000 (21:23 +0300)
committerMrBean <redacted>
Fri, 20 Apr 2012 18:23:50 +0000 (21:23 +0300)
mod.cservice/INVITECommand.cc

index a92aaeed1bf5644d38c8d6912457684795b1a8be..0970c10b94e5931c4e5a6ecdc59b0c270646242a 100755 (executable)
@@ -67,12 +67,27 @@ bool INVITECommand::Exec( iClient* theClient, const string& Message )
         *  Check the channel is actually registered.
         */
 
-       int max_channels = st.size() < 10 ? st.size() : 10;
-       for(int i=1; i < max_channels;++i) {
-               sqlChannel* theChan = bot->getChannelRecord(st[i]);
+       char delim = 0;
+       string source;
+       int i = 1;
+       string::size_type pos = st[1].find_first_of(',');
+       /* Found a comma? */
+       if (string::npos != pos) {
+               /* We'll do a comma seperated search then. */
+               source = st.assemble(1);
+               delim = ',';
+               i = 0;
+       } else {
+               source = Message;
+               delim = ' ';
+       }
+       StringTokenizer st2(source, delim);
+       int max_channels = st2.size() < 10 ? st2.size() : 10;
+       for(; i < max_channels;++i) {
+               sqlChannel* theChan = bot->getChannelRecord(st2[i]);
                if (!theChan) {
                        bot->Notice(theClient, bot->getResponse(theUser, language::chan_not_reg).c_str(),
-                               st[i].c_str());
+                               st2[i].c_str());
                        continue;
                }