Encapsulate obscure detail that lower numeric priority is higher queue priority
[clinton/bobotpp.git] / source / ServerQueueItem.C
index 7b98320..8daf8c4 100644 (file)
@@ -1,5 +1,6 @@
 // ServerQueueItem.C  -*- C++ -*-
 // Copyright (c) 1998 Etienne BERNARD
+// Copyright (c) 2005 Clinton Ebadi
 
 // 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
@@ -13,7 +14,8 @@
 
 // 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.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
 
 #include "StringTokenizer.H"
 #include "ServerQueue.H"
@@ -23,21 +25,23 @@ ServerQueueItem::ServerQueueItem(int pr, int pen, int t)
   : priority(pr), penalty(pen), type(t)
 { }
 
-
-
 ServerQueueOtherItem::ServerQueueOtherItem(String l, int pr,
                                            int pen, int t)
   : ServerQueueItem(pr, pen, t), line(l)
 { }
 
+bool ServerQueueItem::operator< (const ServerQueueItem & item)
+{ 
+  // lower numeric priority is higher priority
+  return item.priority < priority; 
+}
+
 String
 ServerQueueOtherItem::getLine()
 {
   return line;
 }
 
-
-
 ServerQueueChannelModeItem::ServerQueueChannelModeItem(String c, String m, String p)
   : ServerQueueItem(CHANNELMODE_PRIORITY,
                     CHANNELMODE_PENALTY,
@@ -45,7 +49,7 @@ ServerQueueChannelModeItem::ServerQueueChannelModeItem(String c, String m, Strin
     channel(c), mode(m), parameters(p)
 {
   StringTokenizer st(p);
-  paramcount = st.countTokens();
+  paramcount = st.count_tokens();
 }
 
 bool