2
typingnotifytask.h - Send/Receive typing notifications
4
Copyright (c) 2004 by Matt Rogers <mattr@kde.org>
5
Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
7
*************************************************************************
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
14
*************************************************************************
17
#include "typingnotifytask.h"
23
#include "connection.h"
28
TypingNotifyTask::TypingNotifyTask( Task* parent )
31
m_notificationType = 0x0000;
34
TypingNotifyTask::~TypingNotifyTask()
38
bool TypingNotifyTask::forMe( const Transfer* transfer ) const
40
const SnacTransfer* st = dynamic_cast<const SnacTransfer*>( transfer );
44
if ( st->snacService() == 0x0004 && st->snacSubtype() == 0x0014 )
50
bool TypingNotifyTask::take( Transfer* transfer )
52
if ( forMe( transfer ) )
54
setTransfer( transfer );
63
void TypingNotifyTask::onGo()
65
FLAP f = { 0x02, 0, 0 };
66
SNAC s = { 0x0004, 0x0014, 0x0000, client()->snacSequence() };
67
Buffer* b = new Buffer();
69
//notification id cookie. it's a quad-word
70
b->addDWord( 0x00000000 );
71
b->addDWord( 0x00000000 );
73
b->addWord( 0x0001 ); //mtn messages are always sent as type 1 messages
75
b->addBUIN( m_contact.toLatin1() );
77
b->addWord( m_notificationType );
79
Transfer* t = createTransfer( f, s, b );
82
setSuccess( 0, QString() );
85
void TypingNotifyTask::handleNotification()
87
/* NB ICQ5 (windows) seems to only send 0x0002 and 0x0001, so I'm interpreting 0x001 as typing finished here - Will */
88
Buffer* b = transfer()->buffer();
90
//I don't care about the QWORD or the channel
93
QString contact( b->getBUIN() );
95
quint32 word = b->getWord();
99
kDebug(OSCAR_RAW_DEBUG) << contact << " has finished typing";
100
emit typingFinished( contact );
103
kDebug(OSCAR_RAW_DEBUG) << contact << " has typed a word";
104
emit typingFinished( contact );
107
kDebug(OSCAR_RAW_DEBUG) << contact << " has started typing";
108
emit typingStarted( contact );
111
kDebug(OSCAR_RAW_DEBUG) << contact << " typed an unknown typing notification - " << word;
115
void TypingNotifyTask::setParams( const QString& contact, int notifyType )
118
m_notificationType = notifyType;
121
#include "typingnotifytask.moc"
123
// kate: indent-mode csands; space-indent off; replace-tabs off;