]> jfr.im git - irc/UndernetIRC/gnuworld.git/commitdiff
modify output of username info with flags line
authorDan-m00 <redacted>
Tue, 1 Jan 2008 19:03:41 +0000 (19:03 +0000)
committerDan-m00 <redacted>
Tue, 1 Jan 2008 19:03:41 +0000 (19:03 +0000)
ChangeLog
mod.cservice/CHANINFOCommand.cc

index 906899cd8d517ebe4205aa58228fed9cdf4e22a9..4a43aef48c1ff7e5c41af5a7d683984dec223abd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-// $Id: ChangeLog,v 1.150 2008/01/01 13:49:18 kewlio Exp $ //
+// $Id: ChangeLog,v 1.151 2008/01/01 19:03:41 kewlio Exp $ //
+
+2008-01-01     Dan-m00 <daniel@undernet.org>
+               * mod.cservice/CHANINFOCommand.cc: modify 'info <username>'
+                       output to give a flags line for various settings.
 
 2008-01-01     Dan-m00 <daniel@undernet.org>
                * doc/update_config_20080101.sql:
index 868a17f6ed0e6837a35b868a44ec272e8547c18a..dc04f63c0fc5ca4489c23fc9beaf0864ce9aa431 100755 (executable)
@@ -28,7 +28,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
  * USA.
  *
- * $Id: CHANINFOCommand.cc,v 1.59 2007/12/31 20:24:43 kewlio Exp $
+ * $Id: CHANINFOCommand.cc,v 1.60 2008/01/01 19:03:41 kewlio Exp $
  */
 
 #include       <string>
@@ -43,7 +43,7 @@
 #include       "dbHandle.h"
 #include       "cservice_config.h"
 
-const char CHANINFOCommand_cc_rcsId[] = "$Id: CHANINFOCommand.cc,v 1.59 2007/12/31 20:24:43 kewlio Exp $" ;
+const char CHANINFOCommand_cc_rcsId[] = "$Id: CHANINFOCommand.cc,v 1.60 2008/01/01 19:03:41 kewlio Exp $" ;
 
 namespace gnuworld
 {
@@ -115,8 +115,63 @@ if( string::npos == st[ 1 ].find_first_of( '#' ) )
                }
        }
 
-       /* Keep details private. */
+       /* get the language STRING */
+       stringstream s;
+       int langId = theUser->getLanguageId();
+       s       << langId
+               << ends ;
+       string langString = s.str();
+
+       for (cservice::languageTableType::iterator ptr = bot->languageTable.begin();
+               ptr != bot->languageTable.end(); ptr++)
+       {
+               if (ptr->second.first == langId)
+               {
+                       langString = ptr->first;
+                       break;
+               }
+       }
+
+       /* build up a flag string */
+       string flagsSet;
+
+       if (theUser->getFlag(sqlUser::F_GLOBAL_SUSPEND)) 
+               flagsSet += "SUSPEND ";
+       if (theUser->getFlag(sqlUser::F_INVIS))
+               flagsSet += "INVISIBLE ";
+       if (theUser->getFlag(sqlUser::F_NOADDUSER))
+               flagsSet += "NOADDUSER ";
+       /* flags only visible to *1+ users */
+       if (adminAccess)
+       {
+               if (theUser->getFlag(sqlUser::F_FRAUD))
+                       flagsSet += "FRAUD ";
+               if (theUser->getFlag(sqlUser::F_NOPURGE))
+                       flagsSet += "NOPURGE ";
+               if (theUser->getFlag(sqlUser::F_ALUMNI))
+                       flagsSet += "ALUMNI ";
+               if (theUser->getFlag(sqlUser::F_NOADMIN))
+                       flagsSet += "DISABLEAUTH ";
+       }
+       /* flags with variables */
+       if (langString.size() > 0)
+               flagsSet += "LANG=" + langString + " ";
+       /* flags with variables for admins (or self-viewing) only */
+       if (adminAccess || (tmpUser == theUser))
+       {
+               int maxLogins = theUser->getMaxLogins();
+               stringstream ss;
+               ss      << maxLogins
+                       << ends ;
+               if (maxLogins > 1)
+                       flagsSet += "MAXLOGINS=" + ss.str() + " ";
+       }
 
+       /* set 'NONE' if no flags */
+       if (flagsSet.size() == 0)
+               flagsSet = "NONE ";
+
+       /* Keep details private. */
        if (theUser->getFlag(sqlUser::F_INVIS))
                {
 
@@ -128,6 +183,12 @@ if( string::npos == st[ 1 ].find_first_of( '#' ) )
                                        language::no_peeking,
                                        string("Unable to view user details (Invisible)")));
 
+                       /* Show flags even when invisible */
+                       bot->Notice(theClient,
+                               bot->getResponse(tmpUser, language::status_flags,
+                               string("Flags set: %s")).c_str(),
+                               flagsSet.c_str());
+
                        /*
                         * Show the channels this guy owns to opers.
                         */
@@ -182,26 +243,9 @@ if( string::npos == st[ 1 ].find_first_of( '#' ) )
        if (!aCount) bot->Notice(theClient, "  OFFLINE");
 
        bot->Notice(theClient,
-               bot->getResponse(tmpUser,
-                       language::lang,
-                       string("Language: %i")).c_str(),
-               theUser->getLanguageId());
-
-       if (theUser->getFlag(sqlUser::F_INVIS))
-               {
-               bot->Notice(theClient, "INVISIBLE is On");
-               } else
-               {
-               bot->Notice(theClient, "INVISIBLE is Off");
-               }
-
-       if (theUser->getFlag(sqlUser::F_NOADDUSER))
-               {
-               bot->Notice(theClient, "NOADDUSER is On");
-               } else
-               {
-               bot->Notice(theClient, "NOADDUSER is Off");
-               }
+               bot->getResponse(tmpUser, language::status_flags,
+                       string("Flags set: %s")).c_str(),
+                       flagsSet.c_str());
 
        bot->Notice(theClient,
                bot->getResponse(tmpUser,
@@ -209,11 +253,6 @@ if( string::npos == st[ 1 ].find_first_of( '#' ) )
                        string("Last Seen: %s")).c_str(),
                bot->prettyDuration(theUser->getLastSeen()).c_str());
 
-       if (theUser->getFlag(sqlUser::F_GLOBAL_SUSPEND))
-               {
-               bot->Notice(theClient, "\002** This account has been suspended **\002");
-               }
-
        if(adminAccess)
        {
        /*
@@ -305,9 +344,6 @@ if( string::npos == st[ 1 ].find_first_of( '#' ) )
                                theUser->getLastHostMask().c_str());
                }
 
-               bot->Notice(theClient, "Max Logins: %i",
-                       theUser->getMaxLogins());
-
 #ifdef USE_NOTES
                if(theUser->getFlag(sqlUser::F_NONOTES))
                        {