ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FreeBSDAdmin/IRC/smart_ison.cpp
(Generate patch)

Comparing FreeBSDAdmin/IRC/smart_ison.cpp (file contents):
Revision 1268 by douglas, 2010-03-22T14:11:11-07:00 vs.
Revision 1295 by douglas, 2010-04-09T05:48:07-07:00

# Line 20 | Line 20
20  
21   struct SmartISONTimer : public CTimer
22   {
23 <        SmartISONTimer(CModule *module) : CTimer(module, 15, 0, "Smart ISON", "Smart ISON") {}
23 >        SmartISONTimer(CModule *module) : CTimer(module, 15, 0, "Smart ISON", "Keeps track of online and offline nicks so ISON requests from Pidgin are not truncated") {}
24          virtual ~SmartISONTimer() {}
25  
26          virtual void RunJob();
# Line 78 | Line 78 | public:
78                          table.SetCell("Command", "Queue");
79                          table.SetCell("Description", "List the nick status queue");
80                          table.AddRow();
81 +                        table.SetCell("Command", "Request");
82 +                        table.SetCell("Description", "List the last nick request");
83 +                        table.AddRow();
84 +                        table.SetCell("Command", "Stats");
85 +                        table.SetCell("Description", "List nick and queue statistics");
86 +                        table.AddRow();
87                          table.SetCell("Command", "Version");
88                          table.SetCell("Description", "Display module version");
89  
# Line 121 | Line 127 | public:
127  
128                                  PutModule(table);
129                          }
130 +                else if (theCommand.Equals("Request"))
131 +                        if (request_.empty())
132 +                                PutModule("Last nick request empty");
133 +                        else
134 +                        {
135 +                                CTable table;
136 +
137 +                                table.AddColumn("Nick");
138 +
139 +                                typedef std::set<CString, Compare> NickSet;
140 +
141 +                                _foreach (NickSet, nick, request_)
142 +                                {
143 +                                        table.AddRow();
144 +                                        table.SetCell("Nick", *nick);
145 +                                }
146 +
147 +                                PutModule(table);
148 +                        }
149 +                else if (theCommand.Equals("Stats"))
150 +                {
151 +                        CTable table;
152 +
153 +                        table.AddColumn("Item");
154 +                        table.AddColumn("Count");
155 +                        table.AddRow();
156 +                        table.SetCell("Item", "Nicks");
157 +                        table.SetCell("Count", CString(nicks_.size()));
158 +
159 +                        typedef std::map<CString, bool, Compare> NickMap;
160 +                        size_t online(0), offline(0);
161 +
162 +                        _foreach (NickMap, nick, nicks_)
163 +                                if (nick->second)
164 +                                        ++online;
165 +                                else
166 +                                        ++offline;
167 +
168 +                        table.AddRow();
169 +                        table.SetCell("Item", "Online");
170 +                        table.SetCell("Count", CString(online));
171 +                        table.AddRow();
172 +                        table.SetCell("Item", "Offline");
173 +                        table.SetCell("Count", CString(offline));
174 +                        table.AddRow();
175 +                        table.SetCell("Item", "Queue");
176 +                        table.SetCell("Count", CString(queue_.size()));
177 +                        table.AddRow();
178 +                        table.SetCell("Item", "Request");
179 +                        table.SetCell("Count", CString(request_.size()));
180 +
181 +                        PutModule(table);
182 +                }
183                  else if (theCommand.Equals("Version"))
184                          PutModule("$Id$");
185                  else
# Line 343 | Line 402 | CModule::EModRet SmartISON::OnUserRaw(CS
402          return CONTINUE;
403   }
404  
405 < MODULEDEFS(SmartISON, "Smart ISON");
405 > MODULEDEFS(SmartISON, "Keeps track of online and offline nicks so ISON requests from Pidgin are not truncated");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines