summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/oscar/liboscar/ssilisttask.h
blob: 4358cd9ea171f0e5942594373a994f89abb646b0 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
  Kopete Oscar Protocol
  ssilisttask.h - handles all operations dealing with the whole SSI list

  Copyright (c) 2004 Matt Rogers <mattr@kde.org>

  Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>

  *************************************************************************
  *                                                                       *
  * This library is free software; you can redistribute it and/or         *
  * modify it under the terms of the GNU Lesser General Public            *
  * License as published by the Free Software Foundation; either          *
  * version 2 of the License, or (at your option) any later version.      *
  *                                                                       *
  *************************************************************************
*/
#ifndef SSILISTTASK_H
#define SSILISTTASK_H

#include <task.h>

class SSI;
class SSIManager;

/**
 * This task handles all the operations dealing with the whole SSI list
 * All SNACs handled by this task are in family 13. Subtypes 5, 6, and 7
 * are handled by individual functions. Subtype F is handled in the take()
 * function. We don't use subtype 4 because the same thing can be accomplished
 * using subtypes 5 and 6 together.
 *
 * @author Matt Rogers
*/
class SSIListTask : public Task
{
Q_OBJECT
  
public:
	SSIListTask( Task* parent );
	~SSIListTask();

	virtual bool take( Transfer* transfer );

protected:
	virtual bool forMe( const Transfer* transfer ) const;
	virtual void onGo();

signals:
	/** We have a new group */
	void newGroup( const Oscar::SSI& );

	/** We have a new contact */
	void newContact( const Oscar::SSI& );
	
	/**
	 * We have a new contact and they're on the visible list
	 */
	void newVisibleItem( const Oscar::SSI& );
	
	/**
	 * We have a new contact and they're on the invisible list
	 */
	void newInvisibleItem( const Oscar::SSI& );
	
	/**
	 * We have a new item 
	 * Used for items we don't explicitly handle yet
	 */
	void newItem( const Oscar::SSI& );

private:

	/**
	 * Handle the list we get from the server
	 * This is SNAC( 0x13, 0x06 )
	 */
	void handleSSIListReply();

	/**
	 * Check the timestamp of the local SSI copy
	 * If it's up to date, we'll get SNAC( 13, 06 )
	 * If it's out of date, we'll get SNAC( 13, 0F )
	 * This is SNAC( 0x13, 0x05 )
	 */
	void checkSSITimestamp();

	/**
	 * The timestamp of the SSI is up to date
	 * This is SNAC( 0x13, 0x0F )
	 */
	void handleSSIUpToDate();

	
private:
	/**
	 * Pointer to the SSI manager so we don't have to keep
	 * calling client()->ssiManager(). It's guaranteed to
	 * exist.
	 */
	SSIManager* m_ssiManager;

};

#endif

// kate: tab-width 4; indent-mode csands;