|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
IO Notify Messanger
|
|
|
|
|
|
|
|
$$Id$$
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#include "ioNotify.h"
|
|
|
|
#include "ksircprocess.h"
|
|
|
|
|
|
|
|
#include <kdebug.h>
|
|
|
|
|
|
|
|
KSircIONotify::KSircIONotify(KSircProcess *_proc)
|
|
|
|
: TQObject(),
|
|
|
|
KSircMessageReceiver(_proc)
|
|
|
|
{
|
|
|
|
proc = _proc;
|
|
|
|
setBroadcast(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KSircIONotify::~KSircIONotify()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void KSircIONotify::sirc_receive(TQCString str, bool)
|
|
|
|
{
|
|
|
|
if(str.tqcontains("*)*")){
|
|
|
|
int s1, s2;
|
|
|
|
s1 = str.tqfind("Signon by") + 10;
|
|
|
|
s2 = str.tqfind(" ", s1);
|
|
|
|
if(s1 < 0 || s2 < 0){
|
|
|
|
kdDebug(5008) << "Nick Notify mesage broken: " << str << endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
TQString nick = str.mid(s1, s2 - s1);
|
|
|
|
emit notify_online(nick);
|
|
|
|
}
|
|
|
|
else if(str.tqcontains("*(*")){
|
|
|
|
int s1, s2;
|
|
|
|
s1 = str.tqfind("Signoff by") + 11;
|
|
|
|
s2 = str.tqfind(" ", s1);
|
|
|
|
if(s1 < 0 || s2 < 0){
|
|
|
|
kdDebug(5008) << "Nick Notify mesage broken: " << str << endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
TQString nick = str.mid(s1, s2 - s1);
|
|
|
|
emit notify_offline(nick);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
proc->getWindowList()["!default"]->sirc_receive(str);
|
|
|
|
kdDebug(5008) << "Nick Notifer got " << str << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KSircIONotify::control_message(int, TQString)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
filterRuleList *KSircIONotify::defaultRules()
|
|
|
|
{
|
|
|
|
filterRule *fr;
|
|
|
|
filterRuleList *frl = new filterRuleList();
|
|
|
|
frl->setAutoDelete(TRUE);
|
|
|
|
fr = new filterRule();
|
|
|
|
fr->desc = "Send Nick Notifies to notifier parser";
|
|
|
|
fr->search = "^\\*\\S?[\\(\\)]\\S?\\* ";
|
|
|
|
fr->from = "^";
|
|
|
|
fr->to = "~!notify~";
|
|
|
|
frl->append(fr);
|
|
|
|
return frl;
|
|
|
|
}
|
|
|
|
#include "ioNotify.moc"
|