+ this->changed = true;
+ }
+
+ void InsertOrder(irc::string channel, int count)
+ {
+ /* This function figures out where in the sorted list to put an item from the hash */
+ SortedIter a;
+ for (a = so->begin(); a != so->end(); a++)
+ {
+ /* Found an item equal to or less than, we insert our item before it */
+ if (a->first <= count)
+ {
+ so->insert(a,std::pair<int,irc::string>(count,channel));
+ return;
+ }
+ }
+ /* There are no items in the list yet, insert something at the beginning */
+ so->insert(so->begin(), std::pair<int,irc::string>(count,channel));
+ }
+
+ void SortList()
+ {
+ /* Sorts the hash into the sorted list using an insertion sort */
+ so->clear();
+ for (StatsIter a = sh->begin(); a != sh->end(); a++)
+ InsertOrder(a->first, a->second);
+ for (user_hash::iterator u = ServerInstance->clientlist->begin(); u != ServerInstance->clientlist->end(); u++)
+ {
+ StatsHash::iterator n = Servers->find(u->second->server);
+ if (n != Servers->end())
+ {
+ n->second++;
+ }
+ else
+ {
+ Servers->insert(std::make_pair<irc::string,int>(u->second->server,1));
+ }
+ }
+ this->changed = false;