summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/clientiface.h
blob: 02162189e4b0887ee49078a3c44055413a971200 (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
#ifndef KDED_NETWORKSTATUS_CLIENTIFACE_H
#define KDED_NETWORKSTATUS_CLIENTIFACE_H

#include "networkstatuscommon.h"

#include <dcopobject.h>

class ClientIface : virtual public DCOPObject
{
K_DCOP
k_dcop:
	/** Get the set of networks that the daemon is aware of.  Mostly for debug */
	virtual QStringList networks() = 0;
	/**
	 * Get the status of the connection to the given host.
	 * @param host 
	 * @return a NetworkStatus::EnumStatus representing the state of the connection to the given host
	 */
	virtual int status( const QString & host = QString::null ) = 0;
	/**
	 * Request a connection to the named host, registering the application's usage of this connection
	 * @param host The hostname the client wants to connect to.
	 * @param userInitiated Indicates whether the connection is a direct result of a user action or is a background task.  Used by the daemon to decide whether to create an on-demand connection.
	 * @return An NetworkStatus::EnumRequestResult indicating whether the request was accepted
	 */
	virtual int request( const QString &  host, bool userInitiated ) = 0;
	/**
	 * Indicate that a previously registered connection to the given host is no longer needed by this client
	 * @param host The hostname being relinquished.
	 */
	virtual void relinquish( const QString & host ) = 0;
	/**
	 * Indicate that a communication failure has occured for a given host
	 * @param host The hostname for which the failure occurred.
	 * @return True indicates the caller should try again to lookup the host, as the daemon has another IP address available.
	 */
	virtual bool reportFailure( const QString &  host ) = 0;
	/**
	 * Utility method to check the daemon's status
	 */
k_dcop_signals:
	/**
	 * A status change occurred for the network(s) used to connect to the given host.
	 * @param host The host which the application has indicated it is using
	 * @param status The new status of the network used to reach host.
	 */
	void statusChange( QString host, int status );
	/**
	 * The network would like to shut down - any clients using this host are to finish using it immediately and call 
	 * relinquish() when done.
	 * @param host The host, registered as in use by applications, which is about to be disconnected.
	 */
	void shutdownRequested( QString host );
};

#endif