]> jfr.im git - irc/evilnet/mod.chanfix.git/commitdiff
Added USERSCORES command, preparing to synch to CVS
authorbuzlip01 <redacted>
Sat, 1 Apr 2006 12:22:24 +0000 (12:22 +0000)
committerbuzlip01 <redacted>
Sat, 1 Apr 2006 12:22:24 +0000 (12:22 +0000)
Makefile.am
Makefile.in
USERSCORESCommand.cc [new file with mode: 0644]
chanfix.cc
chanfix.example.conf.in
chanfixCommands.h
doc/chanfix.language.english.sql
responses.h

index 81f8bda86746b9c1051ee92c1c5d90afe623c828..3eb97f5542417b904ff34d04bbe4acfc9a30c810 100644 (file)
@@ -37,6 +37,7 @@ libchanfix_la_SOURCES = chanfix.cc \
        UNALERTCommand.cc \
        UNBLOCKCommand.cc \
        UNSUSPENDCommand.cc \
+       USERSCORESCommand.cc \
        USETCommand.cc \
        WHOGROUPCommand.cc \
        WHOISCommand.cc \
index 287565562c8c7c29d5e314e0a3ee98ef759a5671..6bf9fd5051e42905efc9d7b1fc3fe6f6fc9593a0 100644 (file)
@@ -91,10 +91,12 @@ am_libchanfix_la_OBJECTS = libchanfix_la-chanfix.lo \
        libchanfix_la-STATUSCommand.lo libchanfix_la-SUSPENDCommand.lo \
        libchanfix_la-UNALERTCommand.lo \
        libchanfix_la-UNBLOCKCommand.lo \
-       libchanfix_la-UNSUSPENDCommand.lo libchanfix_la-USETCommand.lo \
-       libchanfix_la-WHOGROUPCommand.lo libchanfix_la-WHOISCommand.lo \
-       libchanfix_la-sqlChanOp.lo libchanfix_la-sqlChannel.lo \
-       libchanfix_la-sqlManager.lo libchanfix_la-sqlUser.lo
+       libchanfix_la-UNSUSPENDCommand.lo \
+       libchanfix_la-USERSCORESCommand.lo \
+       libchanfix_la-USETCommand.lo libchanfix_la-WHOGROUPCommand.lo \
+       libchanfix_la-WHOISCommand.lo libchanfix_la-sqlChanOp.lo \
+       libchanfix_la-sqlChannel.lo libchanfix_la-sqlManager.lo \
+       libchanfix_la-sqlUser.lo
 libchanfix_la_OBJECTS = $(am_libchanfix_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
 depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -265,6 +267,7 @@ libchanfix_la_SOURCES = chanfix.cc \
        UNALERTCommand.cc \
        UNBLOCKCommand.cc \
        UNSUSPENDCommand.cc \
+       USERSCORESCommand.cc \
        USETCommand.cc \
        WHOGROUPCommand.cc \
        WHOISCommand.cc \
@@ -423,6 +426,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-UNALERTCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-UNBLOCKCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-UNSUSPENDCommand.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-USERSCORESCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-USETCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-WHOGROUPCommand.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libchanfix_la-WHOISCommand.Plo@am__quote@
@@ -691,6 +695,13 @@ libchanfix_la-UNSUSPENDCommand.lo: UNSUSPENDCommand.cc
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -c -o libchanfix_la-UNSUSPENDCommand.lo `test -f 'UNSUSPENDCommand.cc' || echo '$(srcdir)/'`UNSUSPENDCommand.cc
 
+libchanfix_la-USERSCORESCommand.lo: USERSCORESCommand.cc
+@am__fastdepCXX_TRUE@  if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -MT libchanfix_la-USERSCORESCommand.lo -MD -MP -MF "$(DEPDIR)/libchanfix_la-USERSCORESCommand.Tpo" -c -o libchanfix_la-USERSCORESCommand.lo `test -f 'USERSCORESCommand.cc' || echo '$(srcdir)/'`USERSCORESCommand.cc; \
+@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/libchanfix_la-USERSCORESCommand.Tpo" "$(DEPDIR)/libchanfix_la-USERSCORESCommand.Plo"; else rm -f "$(DEPDIR)/libchanfix_la-USERSCORESCommand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='USERSCORESCommand.cc' object='libchanfix_la-USERSCORESCommand.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -c -o libchanfix_la-USERSCORESCommand.lo `test -f 'USERSCORESCommand.cc' || echo '$(srcdir)/'`USERSCORESCommand.cc
+
 libchanfix_la-USETCommand.lo: USETCommand.cc
 @am__fastdepCXX_TRUE@  if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libchanfix_la_CXXFLAGS) $(CXXFLAGS) -MT libchanfix_la-USETCommand.lo -MD -MP -MF "$(DEPDIR)/libchanfix_la-USETCommand.Tpo" -c -o libchanfix_la-USETCommand.lo `test -f 'USETCommand.cc' || echo '$(srcdir)/'`USETCommand.cc; \
 @am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/libchanfix_la-USETCommand.Tpo" "$(DEPDIR)/libchanfix_la-USETCommand.Plo"; else rm -f "$(DEPDIR)/libchanfix_la-USETCommand.Tpo"; exit 1; fi
diff --git a/USERSCORESCommand.cc b/USERSCORESCommand.cc
new file mode 100644 (file)
index 0000000..0026e8a
--- /dev/null
@@ -0,0 +1,92 @@
+/**
+ * SCORECommand.cc
+ *
+ * 03/06/2006 - Wouter Coekaerts <wouter@coekaerts.be>
+ * Initial Version
+ *
+ * Shows all the channels <user> has a score in
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ *
+ * $Id$
+ */
+
+#include <sstream>
+#include <vector>
+
+#include "gnuworld_config.h"
+
+#include "chanfix.h"
+#include "responses.h"
+#include "StringTokenizer.h"
+#include "sqlChanOp.h"
+#include "sqlUser.h"
+
+RCSTAG("$Id$");
+
+namespace gnuworld
+{
+
+namespace cf
+{
+
+void USERSCORESCommand::Exec(iClient* theClient, sqlUser* theUser, const std::string& Message)
+{
+StringTokenizer st(Message);
+
+std::string firstop;
+std::string lastop;
+bool foundOne = false;
+
+for (chanfix::sqlChanOpsType::iterator ptr = bot->sqlChanOps.begin();
+     ptr != bot->sqlChanOps.end(); ptr++) {
+  chanfix::sqlChanOpsType::mapped_type::iterator chanOp = ptr->second.find(st[1]);
+
+  if (chanOp != ptr->second.end()) {
+    if (!foundOne) {
+      // print header
+      foundOne = true;
+      bot->SendTo(theClient,
+                  bot->getResponse(theUser,
+                                   language::userscores_header,
+                                   std::string("Channel Score -- Time first opped / Time last opped.")).c_str());
+    }
+
+    sqlChanOp* curOp = chanOp->second;
+    firstop = bot->tsToDateTime(curOp->getTimeFirstOpped(), false);
+    lastop = bot->tsToDateTime(curOp->getTimeLastOpped(), true);
+    bot->SendTo(theClient, "%s %d -- %s / %s", ptr->first.c_str(),
+                curOp->getPoints(), firstop.c_str(), lastop.c_str());
+  }
+}
+
+if (!foundOne) {
+  bot->SendTo(theClient,
+                  bot->getResponse(theUser,
+                               language::userscores_noscore,
+                               std::string("Account %s doesn't have any scores in the database.")).c_str(),
+                                       st[1].c_str());
+}
+
+bot->logAdminMessage("%s (%s) USERSCORES %s",
+                    theUser ? theUser->getUserName().c_str() : "!NOT-LOGGED-IN!",
+                    theClient->getRealNickUserHost().c_str(),
+                    st[1].c_str());
+
+return;
+}
+} // namespace cf
+} // namespace gnuworld
index 5fb89262a2f94a4a65cbb6c417a3454be56b0897..57ffe604c7ac236ba0b5c5a0184d4fccfc25c50e 100644 (file)
@@ -289,6 +289,11 @@ RegisterCommand(new UNSUSPENDCommand(this, "UNSUSPEND",
        2,
        sqlUser::F_USERMANAGER | sqlUser::F_SERVERADMIN
        ));
+RegisterCommand(new USERSCORESCommand(this, "USERSCORES",
+       "<account>",
+       2,
+       sqlUser::F_LOGGEDIN
+       ));
 RegisterCommand(new USETCommand(this, "USET",
        "[username] <option> <value>",
        3,
index b39087f0a20e363f9a4453b41166788dca4af615..b1aed37e7bb27c3c31408c3ac764e482f8918fd6 100644 (file)
@@ -88,6 +88,11 @@ minServersPresent = 75
 # not to the network.
 chanServName = channels.undernet.org
 
+# The full server name of the euworld service. This is used to
+# detect whether euworld has performed a mode and should halt
+# autofixing for a brief period on the channel.
+ccontrolServer = uworld.eu.undernet.org
+
 # ---------------------------------------------------------------------
 # Interface settings
 
index 18129b658f75f7b836d2b7ec10ba5471232ab0b1..cc18f5ad8db35421154eb316ab93732456da2136 100644 (file)
@@ -94,6 +94,7 @@ DECLARE_COMMAND( STATUS )
 /* Logged-in commands */
 DECLARE_COMMAND( CHECK )
 DECLARE_COMMAND( LISTHOSTS )
+DECLARE_COMMAND( USERSCORES )
 DECLARE_COMMAND( USET )
 DECLARE_COMMAND( WHOIS )
 
index 1116b4aa319e4b346af63e392aeb4d5d0b40e06a..cc9c1b4488d0ddd16ecb948e046f7cdad2c69563 100644 (file)
@@ -197,4 +197,6 @@ COPY "translations" FROM stdin;
 1      191     %d channels blocked.    31337   0
 1      192     Current fix has been running for %s     31337   0
 1      193     Current fix is on hold (waiting for ops to join)        31337   0
+1      194     Channel Score -- Time first opped / Time last opped.    31337   0
+1      195     Account %s doesn't have any scores in the database.     31337   0
 \.
index c18d17427850b989ccee0fb4f7fbbf1acc9e2b18..77ea5fe0650157850c2a78f770fa043ff93ff0ca 100644 (file)
@@ -246,6 +246,10 @@ namespace cf
                const int user_not_suspended            = 126;
                const int user_unsuspended              = 127;
 
+               /* USERSCORES */
+               const int userscores_header             = 194;
+               const int userscores_noscore            = 195;
+               
                /* USET */
                const int lang_set_to                   = 128;
                const int send_notices                  = 129;