1 /*
2 Kopete Oscar Protocol
3 $FILENAME.cpp
4
5 Copyright (c) 2004 Matt Rogers <mattr@kde.org>
6
7 Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
8
9 *************************************************************************
10 * *
11 * This library is free software; you can redistribute it and/or *
12 * modify it under the terms of the GNU Lesser General Public *
13 * License as published by the Free Software Foundation; either *
14 * version 2 of the License, or (at your option) any later version. *
15 * *
16 *************************************************************************
17 */
18 #include "clientreadytask.h"
19
20 #include <kdebug.h>
21 #include "buffer.h"
22 #include "connection.h"
23 #include "rateclass.h"
24 #include "rateclassmanager.h"
25 #include "oscartypes.h"
26 #include "oscarutils.h"
27 #include "transfer.h"
28 #include <QList>
29
30 using namespace Oscar;
31
ClientReadyTask(Task * parent)32 ClientReadyTask::ClientReadyTask(Task* parent): Task(parent)
33 {
34 m_classList = client()->rateManager()->classList();
35 }
36
~ClientReadyTask()37 ClientReadyTask::~ClientReadyTask()
38 {
39 }
40
setFamilies(const QList<int> & families)41 void ClientReadyTask::setFamilies( const QList<int>& families )
42 {
43 m_familyList = families;
44 }
45
onGo()46 void ClientReadyTask::onGo()
47 {
48 FLAP f = { 0x02, 0, 0 };
49 SNAC s = { 0x0001, 0x0002, 0x0000, client()->snacSequence() };
50 Buffer* buffer = new Buffer();
51
52 kDebug( OSCAR_RAW_DEBUG ) << "Sending client ready, end of login";
53 //nasty nasty nasty hack to get all the packets to work
54 QList<int>::const_iterator rcEnd = m_familyList.constEnd();
55 for ( QList<int>::const_iterator it = m_familyList.constBegin(); it != rcEnd; ++it )
56 {
57 //I have no idea what any of these values mean. I just copied them from oscarsocket
58 int i = ( *it );
59 buffer->addWord( i );
60 switch ( i )
61 {
62 case 0x0001:
63 buffer->addWord( 0x0004 );
64 break;
65 case 0x0013:
66 buffer->addWord( client()->isIcq() ? 0x0004 : 0x0003 );
67 break;
68 default:
69 buffer->addWord( 0x0001 );
70 };
71
72 if ( client()->isIcq() )
73 {
74 buffer->addDWord( 0x0110164F ); // ICQ dll library version
75 }
76 else
77 {
78 buffer->addDWord( 0x0110145D ); // AIM dll library version
79 }
80 }
81
82 //send the damn thing so we can finally be finished
83 //with the hell that is oscar login. (just wait until you get a message)
84 Transfer* t = createTransfer( f, s, buffer );
85 send( t );
86 setSuccess( 0, QString() );
87
88 }
89
90