]> jfr.im git - irc/UndernetIRC/gnuworld.git/commitdiff
- More robust GL parser (doesn't break on Nefarious anymore)
authorSpike <redacted>
Mon, 14 Mar 2011 09:40:57 +0000 (10:40 +0100)
committerSpike <redacted>
Mon, 14 Mar 2011 09:40:57 +0000 (10:40 +0100)
- Show more admincomments on a username INFO

libircu/msg_GL.cc
mod.cservice/CHANINFOCommand.cc

index 814e73b416d239e913e703045072b463be1571df..9d3684ea31f8f13510ed571e69e132e38e454be3 100644 (file)
@@ -90,7 +90,7 @@ if( Params.size() < 5 )
 Gline* newGline = new (std::nothrow) Gline(
                Params[ 0 ],
                Params[ 2 ] + 1,
-               Params[ 6 ],
+               Params[ Params.size() - 1 ],
                atoi( Params[ 3 ] ),
                atoi( Params[ 4 ] )) ;
 assert( newGline != 0 ) ;
index f968784b13488cac2fb5181ddf8705953d400343..9b03a84c5edfea5fc0cc3e94e509ecdf916a1c6f 100755 (executable)
@@ -290,14 +290,27 @@ if( string::npos == st[ 1 ].find_first_of( '#' ) )
        /*
         * Show admins some more details about the user.
         */
-       unsigned int theTime;
-       string userComments = theUser->getLastEvent(sqlUser::EV_COMMENT, theTime);
 
-       if (!userComments.empty() && (userComments[0] != ' '))
-               {
+       stringstream queryString;
+
+       queryString     << "SELECT message,ts"
+                        << " FROM userlog WHERE user_id = "
+                        << theUser->getID()
+                        << " AND event = "
+                        << sqlUser::EV_COMMENT
+                        << " ORDER BY ts DESC LIMIT 3"
+                        << ends;
+
+       if( bot->SQLDb->Exec(queryString, true ) )
+        {
+               for (unsigned int i = 0 ; i < bot->SQLDb->Tuples(); i++) {
+                       string userComments = bot->SQLDb->GetValue(i, 0);
+                       unsigned int theTime = atoi(bot->SQLDb->GetValue(i, 1));
                        bot->Notice(theClient,"\002Admin Comment\002: %s ago (%s)", bot->prettyDuration(theTime).c_str(),
                                userComments.c_str());
                }
+        }
+
 
        if (theUser->getFlag(sqlUser::F_FRAUD))
                {