summaryrefslogtreecommitdiffstats
path: root/ksirc/ioLAG.cpp
blob: ee79094d0deb3e92138907203fb3a8a3af222a49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**********************************************************************

 The IO LAG Controller

 $$Id$$

**********************************************************************/

#include "ioLAG.h"
#include "control_message.h"
#include "ksircprocess.h"

#include <kdebug.h>

KSircIOLAG::KSircIOLAG(KSircProcess *_proc)
  : TQObject(),
    KSircMessageReceiver(_proc)
{
  proc = _proc;
  setBroadcast(FALSE);
  startTimer(30000);
//  startTimer(5000);
//(proc->getWindowList())["!all"]->control_message(SET_LAG, "99");
}


KSircIOLAG::~KSircIOLAG()
{
  killTimers();
}

void KSircIOLAG::sirc_receive(TQCString str, bool)
{

  if(str.tqcontains("*L*")){
    int s1, s2;
    s1 = str.tqfind("*L* ") + 4;
    s2 = str.length();
    if(s1 < 0 || s2 < 0){
      kdDebug(5008) << "Lag mesage broken: " << str << endl;
      return;
    }
    TQString lag = str.mid(s1, s2 - s1);
    //    cerr << "Lag: " << str << endl;
    //    cerr << "Setting lag to: " << lag << endl;
    (proc->getWindowList())["!all"]->control_message(SET_LAG, lag);
  }

}

void KSircIOLAG::control_message(int, TQString)
{
}

void KSircIOLAG::timerEvent ( TQTimerEvent * )
{
  TQCString cmd = "/lag\n";
  emit outputLine(cmd);
}

#include "ioLAG.moc"