]> jfr.im git - irc/UndernetIRC/gnuworld.git/commitdiff
add support to cservice module for ircu2.10.12.13's new '+R' mode
authorDan-m00 <redacted>
Wed, 16 Apr 2008 20:34:38 +0000 (20:34 +0000)
committerDan-m00 <redacted>
Wed, 16 Apr 2008 20:34:38 +0000 (20:34 +0000)
ChangeLog
mod.cservice/JOINCommand.cc
mod.cservice/OPERJOINCommand.cc
mod.cservice/OPERPARTCommand.cc
mod.cservice/PARTCommand.cc
mod.cservice/PURGECommand.cc
mod.cservice/REGISTERCommand.cc
mod.cservice/SETCommand.cc
mod.cservice/cservice.cc

index 9777dd09be83c619fd16edb9090c779dea324685..1745b070bbe316cd9d6f3aa1e07be17eafd3a325 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,16 @@
-// $Id: ChangeLog,v 1.158 2008/04/16 20:29:35 danielaustin Exp $ //
+// $Id: ChangeLog,v 1.159 2008/04/16 20:34:38 danielaustin Exp $ //
+
+2008-04-16     Dan-m00 <daniel@undernet.org>
+               * mod.cservice/cservice.cc:
+               * mod.cservice/JOINCommand.cc:
+               * mod.cservice/OPERJOINCommand.cc:
+               * mod.cservice/OPERPARTCommand.cc:
+               * mod.cservice/PARTCommand.cc:
+               * mod.cservice/PURGECommand.cc:
+               * mod.cservice/REGISTERCommand.cc:
+               * mod.cservice/SETCommand.cc: Add support to cservice module for
+                       new '+R' mode.  Also adjust channel events to watch for
+                       registered channels even when the bot is not present.
 
 2008-04-16     Dan-m00 <daniel@undernet.org>
                * include/Channel.h:
index f98a6222bb458d089210890d874d3349d0f14135..9bfcc98012acdc6e8ceac932accbd3df1d02629d 100755 (executable)
@@ -23,7 +23,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: JOINCommand.cc,v 1.14 2003/06/28 01:21:20 dan_karrels Exp $
+ * $Id: JOINCommand.cc,v 1.15 2008/04/16 20:34:39 danielaustin Exp $
  */
 
 
@@ -36,7 +36,7 @@
 #include       "responses.h"
 #include       "Network.h"
 
-const char JOINCommand_cc_rcsId[] = "$Id: JOINCommand.cc,v 1.14 2003/06/28 01:21:20 dan_karrels Exp $" ;
+const char JOINCommand_cc_rcsId[] = "$Id: JOINCommand.cc,v 1.15 2008/04/16 20:34:39 danielaustin Exp $" ;
 
 namespace gnuworld
 {
@@ -100,9 +100,9 @@ if (theChan->getInChan())
 bot->writeChannelLog(theChan, theClient, sqlChannel::EV_JOIN, "");
 
 theChan->setInChan(true);
-bot->getUplink()->RegisterChannelEvent( theChan->getName(), bot);
+/* force setting mode +R - it is probably set already, but doesn't hurt to check */
 bot->Join(theChan->getName(),
-       "",
+       "+R",
        theChan->getChannelTS(),
        false);
 bot->joinCount++;
index 45ff627d73e02273144d1434ecfc1ba8b94eb27f..66ff8bdc5e9213a05ef3ca32d2d3ed6ba2d11c56 100755 (executable)
@@ -23,7 +23,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: OPERJOINCommand.cc,v 1.15 2005/01/08 23:33:42 dan_karrels Exp $
+ * $Id: OPERJOINCommand.cc,v 1.16 2008/04/16 20:34:39 danielaustin Exp $
  */
 
 #include       <string>
@@ -38,7 +38,7 @@
 #include       "Network.h"
 #include       "cservice_config.h"
 
-const char OPERJOINCommand_cc_rcsId[] = "$Id: OPERJOINCommand.cc,v 1.15 2005/01/08 23:33:42 dan_karrels Exp $" ;
+const char OPERJOINCommand_cc_rcsId[] = "$Id: OPERJOINCommand.cc,v 1.16 2008/04/16 20:34:39 danielaustin Exp $" ;
 
 namespace gnuworld
 {
@@ -109,7 +109,6 @@ bot->logAdminMessage("%s is asking me to join channel %s",
 bot->writeChannelLog(theChan, theClient, sqlChannel::EV_OPERJOIN, "");
 
 theChan->setInChan(true);
-bot->getUplink()->RegisterChannelEvent( theChan->getName(), bot);
 bot->Join(theChan->getName(),
        theChan->getChannelMode(),
        theChan->getChannelTS(),
index 8a0ee19ec66d5c9ed7a4007e979582aa3762816a..46d109f750ae13d3f6c348dadfea4e26b0450dec 100755 (executable)
@@ -23,7 +23,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: OPERPARTCommand.cc,v 1.14 2005/01/08 23:33:42 dan_karrels Exp $
+ * $Id: OPERPARTCommand.cc,v 1.15 2008/04/16 20:34:39 danielaustin Exp $
  */
 
 #include       <string>
@@ -38,7 +38,7 @@
 #include       "Network.h"
 #include       "cservice_config.h"
 
-const char OPERPARTCommand_cc_rcsId[] = "$Id: OPERPARTCommand.cc,v 1.14 2005/01/08 23:33:42 dan_karrels Exp $" ;
+const char OPERPARTCommand_cc_rcsId[] = "$Id: OPERPARTCommand.cc,v 1.15 2008/04/16 20:34:39 danielaustin Exp $" ;
 
 namespace gnuworld
 {
@@ -111,7 +111,6 @@ bot->logAdminMessage("%s is asking me to leave channel %s",
                theChan->getName().c_str());
 
 theChan->setInChan(false);
-bot->getUplink()->UnRegisterChannelEvent(theChan->getName(), bot);
 bot->joinCount--;
 
 bot->Part(theChan->getName(), "At the request of an IRC Operator");
index 5cf52b48f644c437b22bfe8bbd255e20c7829278..08e07a256f731aa526aa7bb088ed5cb76abdab04 100755 (executable)
@@ -23,7 +23,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: PARTCommand.cc,v 1.16 2003/06/28 01:21:20 dan_karrels Exp $
+ * $Id: PARTCommand.cc,v 1.17 2008/04/16 20:34:40 danielaustin Exp $
  */
 
 
@@ -35,7 +35,7 @@
 #include       "responses.h"
 #include       "Network.h"
 
-const char PARTCommand_cc_rcsId[] = "$Id: PARTCommand.cc,v 1.16 2003/06/28 01:21:20 dan_karrels Exp $" ;
+const char PARTCommand_cc_rcsId[] = "$Id: PARTCommand.cc,v 1.17 2008/04/16 20:34:40 danielaustin Exp $" ;
 
 namespace gnuworld
 {
@@ -100,7 +100,6 @@ if (level < level::part)
        }
 
 theChan->setInChan(false);
-bot->getUplink()->UnRegisterChannelEvent(theChan->getName(), bot);
 bot->joinCount--;
 
 /* Forced access. */
index 315091b4aa628cdf0c3e7e21c5c48589f8c3d393..a4d39f7360533c6a9133579a264532f049db7fea 100755 (executable)
@@ -23,7 +23,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: PURGECommand.cc,v 1.21 2008/01/09 23:05:53 kewlio Exp $
+ * $Id: PURGECommand.cc,v 1.22 2008/04/16 20:34:40 danielaustin Exp $
  */
 
 #include       <string>
@@ -39,7 +39,7 @@
 #include       "responses.h"
 #include       "cservice_config.h"
 
-const char PURGECommand_cc_rcsId[] = "$Id: PURGECommand.cc,v 1.21 2008/01/09 23:05:53 kewlio Exp $" ;
+const char PURGECommand_cc_rcsId[] = "$Id: PURGECommand.cc,v 1.22 2008/04/16 20:34:40 danielaustin Exp $" ;
 
 namespace gnuworld
 {
@@ -319,7 +319,12 @@ bot->writeChannelLog(theChan,
 /* Remove from cache.. part channel. */
 bot->sqlChannelCache.erase(theChan->getName());
 bot->sqlChannelIDCache.erase(theChan->getID());
+/* no longer interested in this channel */
 bot->getUplink()->UnRegisterChannelEvent( theChan->getName(), bot ) ;
+/* remove mode 'R' (no longer registered) */
+Channel* tmpChan = Network->findChannel(theChan->getName());
+if (tmpChan)
+       bot->getUplink()->Mode(NULL, tmpChan, string("-R"), string() );
 bot->Part(theChan->getName());
 bot->joinCount--;
 
index 2fe26d229d910595e5c4da71f1c79e25c0bffa20..e5e1a467772b5dc6b3998999304218c4a911eaa0 100755 (executable)
@@ -23,7 +23,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: REGISTERCommand.cc,v 1.22 2007/11/06 13:32:08 kewlio Exp $
+ * $Id: REGISTERCommand.cc,v 1.23 2008/04/16 20:34:43 danielaustin Exp $
  */
 
 #include       <map>
@@ -39,7 +39,7 @@
 #include       "Network.h"
 #include       "responses.h"
 
-const char REGISTERCommand_cc_rcsId[] = "$Id: REGISTERCommand.cc,v 1.22 2007/11/06 13:32:08 kewlio Exp $" ;
+const char REGISTERCommand_cc_rcsId[] = "$Id: REGISTERCommand.cc,v 1.23 2008/04/16 20:34:43 danielaustin Exp $" ;
 
 namespace gnuworld
 {
@@ -291,6 +291,10 @@ bool REGISTERCommand::Exec( iClient* theClient, const string& Message )
        pair<int, int> thePair( newManager->getUserId(), newManager->getChannelId());
        bot->sqlLevelCache.insert(cservice::sqlLevelHashType::value_type(thePair, newManager));
 
+       /* set channel mode R - tmpChan is created further above */
+       if (tmpChan)
+               bot->getUplink()->Mode(NULL, tmpChan, string("+R"), string() );
+
        return true;
 }
 
index 59d023715ed2ee59b7301793d48ab3ec385ff95b..831fab47e7fd603d2df9558c509165a39b2b9c2d 100755 (executable)
@@ -33,7 +33,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: SETCommand.cc,v 1.63 2007/12/31 14:16:43 kewlio Exp $
+ * $Id: SETCommand.cc,v 1.64 2008/04/16 20:34:44 danielaustin Exp $
  */
 
 #include       <string>
@@ -45,7 +45,7 @@
 #include       "responses.h"
 #include       "cservice_config.h"
 
-const char SETCommand_cc_rcsId[] = "$Id: SETCommand.cc,v 1.63 2007/12/31 14:16:43 kewlio Exp $" ;
+const char SETCommand_cc_rcsId[] = "$Id: SETCommand.cc,v 1.64 2008/04/16 20:34:44 danielaustin Exp $" ;
 
 namespace gnuworld
 {
@@ -766,7 +766,6 @@ else
            {
                theChan->setFlag(sqlChannel::F_AUTOJOIN);
                        theChan->setInChan(true);
-                       bot->getUplink()->RegisterChannelEvent( theChan->getName(), bot ) ;
                        bot->Join(theChan->getName(), theChan->getChannelMode(),
                                theChan->getChannelTS(), false);
                        bot->joinCount++;
@@ -782,7 +781,6 @@ else
                theChan->removeFlag(sqlChannel::F_AUTOJOIN);
                        theChan->setInChan(false);
                        bot->joinCount--;
-                       bot->getUplink()->UnRegisterChannelEvent( theChan->getName(), bot ) ;
                        bot->Part(theChan->getName());
                }
            else
index 920fff8dcb447aeffb12be6e854e93b38c84834f..fba68c70ba39a03823b89b4da2e84418928f8c60 100644 (file)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: cservice.cc,v 1.284 2008/01/02 17:32:49 kewlio Exp $
+ * $Id: cservice.cc,v 1.285 2008/04/16 20:34:44 danielaustin Exp $
  */
 
 #include       <new>
@@ -415,28 +415,32 @@ void cservice::BurstChannels()
         *   is on.
         */
 
+       Channel* tmpChan;
        sqlChannelHashType::iterator ptr = sqlChannelCache.begin();
        while (ptr != sqlChannelCache.end())
        {
        sqlChannel* theChan = (ptr)->second;
 
+       /* we're now interested in registered channels even if we're not in it... */
+       MyUplink->RegisterChannelEvent( theChan->getName(), this ) ;
+
        if ( (theChan->getFlag(sqlChannel::F_AUTOJOIN)) && (theChan->getName() != "*") )
                {
+               string tempModes = theChan->getChannelMode();
+               tempModes += 'R';
                MyUplink->JoinChannel( this,
                        theChan->getName(),
-                       theChan->getChannelMode(),
+                       tempModes,
                        theChan->getChannelTS(),
                        true );
 
-               MyUplink->RegisterChannelEvent( theChan->getName(), this ) ;
-
                theChan->setInChan(true);
                joinCount++;
 
                        if (getConfigVar("BAN_CHECK_ON_BURST")->asInt() == 1)
                        {
                                /* check current inhabitants of the channel against our banlist */
-                               Channel* tmpChan = Network->findChannel(theChan->getName());
+                               tmpChan = Network->findChannel(theChan->getName());
                                for (Channel::userIterator chanUsers = tmpChan->userList_begin();
                                        chanUsers != tmpChan->userList_end(); ++chanUsers)
                                {
@@ -445,6 +449,19 @@ void cservice::BurstChannels()
                                        (void)checkBansOnJoin(tmpChan, theChan, tmpUser->getClient());
                                }
                        }
+               } else {
+                       if (theChan->getName() != "*")
+                       {
+                               /* although AUTOJOIN isn't set, set the channel to +R if
+                                * it exists on the Network.
+                                */
+                               tmpChan = Network->findChannel(theChan->getName());
+                               if (tmpChan)
+                               {
+                                       string tempModes = "+R";
+                                       MyUplink->Mode(NULL, tmpChan, tempModes, string() );
+                               }
+                       }
                }
        ++ptr;
        }
@@ -2174,7 +2191,6 @@ void cservice::cacheExpireLevels()
                         */
 
                        theChan->setInChan(false);
-                       MyUplink->UnRegisterChannelEvent(theChan->getName(), this);
                        theChan->removeFlag(sqlChannel::F_AUTOJOIN);
                        theChan->commit();
                        joinCount--;
@@ -3435,6 +3451,12 @@ switch( whichEvent )
                        return ;
                        }
 
+               /* This is a registered channel, check it is set +R.
+                * If not, set it to +R (channel creation)
+                */
+               if (!theChan->getMode(Channel::MODE_REG))
+                       MyUplink->Mode(NULL, theChan, string("+R"), string() );
+
                /*
                 * First thing we do - check if this person is banned.
                 * If so, they're booted out.