summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/smpppdcs/smpppdcsplugin.h
blob: 5214ecc58bf015f76eecfbb582547eb6dfb3a1a9 (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
108
109
110
/*
    smpppdcsplugin.h
 
    Copyright (c) 2002-2003 by Chris Howells         <[email protected]>
    Copyright (c) 2003      by Martijn Klingens      <[email protected]>
    Copyright (c) 2004-2006 by Heiko Schaefer        <[email protected]>
 
    Kopete    (c) 2002-2006 by the Kopete developers <[email protected]>
 
    *************************************************************************
    *                                                                       *
    * This program is free software; you can redistribute it and/or modify  *
    * it under the terms of the GNU General Public License as published by  *
    * the Free Software Foundation; version 2 of the License.               *
    *                                                                       *
    *************************************************************************
*/

#ifndef SMPPPDCSPLUGIN_H
#define SMPPPDCSPLUGIN_H

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "detector.h"
#include "iconnector.h"
#include "smpppdcsiface.h"

#include "kopeteplugin.h"
#include "kopeteaccount.h"

class TQTimer;
class Detector;
class OnlineInquiry;

/**
 * @brief Plugin for the detection of an internet connection
 *
 * This plugin inquires either the smpppd or netstat
 * for an existing internet connection and depending
 * on that connects or disconnects all accounts.
 *
 * Therefore it should be enabled on dial up network
 * connections.
 *
 * @author Chris Howells <[email protected]>, Heiko Sch&auml;fer <[email protected]>
 */
class SMPPPDCSPlugin : public Kopete::Plugin, public IConnector, virtual public SMPPPDCSIFace {
    Q_OBJECT
  TQ_OBJECT
    SMPPPDCSPlugin(const SMPPPDCSPlugin&);
    SMPPPDCSPlugin& operator=(const SMPPPDCSPlugin&);

public:
    /**
     * @brief Creates an <code>SMPPPDCSPlugin</code> instance
     */
    SMPPPDCSPlugin( TQObject *parent, const char *name, const TQStringList &args );

    /**
     * @brief Destroys an <code>SMPPPDCSPlugin</code> instance
     */
    virtual ~SMPPPDCSPlugin();

    // Implementation of DCOP iface
    /**
     * @brief Checks if we are online.
     * @note This method is reserved for future use. Do not use at the moment!
     * @return <code>TRUE</code> if online, otherwise <code>FALSE</code>
     */
    virtual bool isOnline() const;

    /**
     * @brief Sets the status in all allowed accounts.
     * Allowed accounts are set in the config dialog of the plugin.
     *
     * @see SMPPPDCSPrefs
     */
    virtual void setConnectedStatus( bool newStatus );

    virtual TQString detectionMethod() const;

    virtual void aboutToUnload();

public slots:
    void smpppdServerChanged(const TQString& server);

private slots:
    void slotCheckStatus();
    void allPluginsLoaded();

private:
    
	void connectAllowed();
    void disconnectAllowed();

private:

    Detector      * m_detectorSMPPPD;
    Detector      * m_detectorNetstat;
    Detector      * m_detectorNetworkStatus;
    bool            m_pluginConnected;
    TQTimer        * m_timer;
    OnlineInquiry * m_onlineInquiry;
};

#endif /* SMPPPDCSPLUGIN_H */

// vim: set noet ts=4 sts=4 sw=4: