[Konversation-devel] patch for long notify lists

Emil 'nobs' Obermayr nobs at tigress.com
Mon Oct 24 00:17:28 CEST 2005


these patches in server.h and server.cpp allow long notify lists

the server-class gets two variables to store the number of sent ISON and 
received 303 and a string for collecting all parts in one variable

the ISON part of the code cuts the notify list in pieces, and sets the number 
of sent parts

the 303 part of the code collects the answers and waits for removing the gone 
nicks till all parts are collected

this patch will work as long as it is the only one that sends out ISON and 
grabs the 303; additional ISON will confuse the notify list for a while; 
grabbed (lost) 303 might lead in the notify code hanging because it waits for 
the last part of the answer that never comes. So the timer for the next round 
never will be restarted

Its tested for me and it seems to work nicely.

nobs at garou:/usr/local/src/konversation/extragear-network/konversation/src> 
diff server.h my/server.h
562a563,565
>         QString nicksOnlineCollect;
>         int IsonCounterOut, IsonCounterIn;
>

nobs at garou:/usr/local/src/konversation/extragear-network/konversation/src> 
diff server.cpp my/server.cpp> ~/server.patch
853a853,858
>     // collect the parts of the ISON-answers for removing at the end
>     nicksOnlineCollect+=nicksOnline;
>     IsonCounterIn++;
>     kdDebug() << "303-counter: in/out " <<  IsonCounterIn << "/" << 
IsonCounterOut << endl;
>     kdDebug() << "303-list: " << nicksOnline << endl;
>     
886a892,893
>         // did we get all parts of the ISON-answers?
>         if (IsonCounterIn>=IsonCounterOut){
888c895
<         QStringList nickLowerList = QStringList::split(' 
',nicksOnline.lower());
---
>         QStringList nickLowerList = QStringList::split(' 
',nicksOnlineCollect.lower());
894d900
< 
896,899c902
<         for(it = watchList.begin(); it != itEnd; ++it)
<         {
<             QString lcNickName = (*it).lower();
<             if (nickLowerList.find(lcNickName) == nickLowerList.end())
---
>             for(it = watchList.begin(); it != itEnd; ++it)
901,903c904,910
<                 QString nickname = (*it);
<                 if (setNickOffline(nickname))
<                     nicksOnlineChanged = true;
---
>                 QString lcNickName = (*it).lower();
>                 if (nickLowerList.find(lcNickName) == nickLowerList.end())
>                 {
>                     QString nickname = (*it);
>                     if (setNickOffline(nickname))
>                         nicksOnlineChanged = true;
>                 }
904a912,913
>             // Next round
>             startNotifyTimer();
910,912d918
< 
<     // Next round
<     startNotifyTimer();
944c950
<         // But only if there actually are nicks in the notify list
---
>         // But only if there actually are nicks in the notify list 
946c952,956
< 
---
>         // reset the nicksonline-collector
>         IsonCounterOut=1000;
>         IsonCounterIn=0;
>         nicksOnlineCollect="";
>         int IsonCounterOutTemp=0;
948a959,973
>             kdDebug() << "ISON-full-list: " << list << endl;
>             QString listRemain;
>             // is it too long for a single request?
>             while (list.length()>506)
>             {
>                 // find a space for separating the string
>                 int listTruncPos=list.findRev(" ", 506);
>                 listRemain=list.mid(listTruncPos+1);
>                 list.truncate(listTruncPos);
>                 kdDebug() << "ISON-part-list: " << list << endl;
>                 queue("ISON "+list);
>                 IsonCounterOutTemp++;
>                 list=listRemain;
>             }
>             kdDebug() << "ISON-last-part-list: " << list << endl;
949a975,978
>             IsonCounterOutTemp++;
>             // tell the 303-part of the code how many answers we do expect
>             IsonCounterOut=IsonCounterOutTemp;
>             kdDebug() << "ISON-requests: " << IsonCounterOut << endl;


More information about the Konversation-devel mailing list