summaryrefslogtreecommitdiffstats
path: root/konversation/src/linkaddressbook/addressbook.h
blob: 5cf8b9109da1ecc41005c5e7ba44d0e71411f435 (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
/*
  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; either version 2 of the License, or
  (at your option) any later version.
*/

/*
  This class contains functions that interact with kaddressbook.
  begin:     Fri 2004-07-23
  copyright: (C) 2004 by John Tapsell
  email:     john@geola.co.uk
*/

#ifndef ADDRESSBOOK_H
#define ADDRESSBOOK_H

#include <tdeabc/addressbook.h>
#include <tdeabc/stdaddressbook.h>

#include <kstaticdeleter.h>
#include <tqobject.h>
#include <tqregexp.h>
#include <config.h>
#include "kimiface.h"

#include "../images.h"
#include "../nickinfo.h"
#include "addressbook_base.h"

namespace Konversation
{
    class Addressbook : public AddressbookBase
    {
        TQ_OBJECT
  
            public:

            virtual ~Addressbook();               // This needs to be public so it can be deleted by our static pointer
            static Addressbook *self();
            TQStringList allContactsNicks();
            TQStringList allContacts();
            TQStringList reachableContacts();
            TQStringList onlineContacts();
            TQStringList fileTransferContacts();
            bool isPresent( const TQString &uid );
            TQString displayName( const TQString &uid );
            TQString presenceString( const TQString &uid );
            bool canReceiveFiles( const TQString &uid );
            bool canRespond( const TQString &uid );
            TQString locate( const TQString &contactId, const TQString &protocol );
            // metadata
            TQPixmap icon( const TQString &uid );
            TQString context( const TQString &uid );
            virtual int presenceStatus(const TQString &uid);
            // App capabilities
            TQStringList protocols();

            /**
             * Message a contact by their metaContactId, aka their uid in KABC.
             */
            void messageContact( const TQString &uid, const TQString& message );

            /**
             * Open a chat to a contact, and optionally set some initial text
             */
            void messageNewContact(  const TQString &contactId, const TQString &protocolId );

            /**
             * Message a contact by their metaContactId, aka their uid in KABC.
             */
            void chatWithContact( const TQString &uid );

            /**
             * Send the file to the contact
             */
            void sendFile(const TQString &uid, const KURL &sourceURL,
                const TQString &altFileName = TQString(), uint fileSize = 0);

            /**
             * Lets outsiders tell us to emit presenceChanged signal.
             */
            void emitContactPresenceChanged( const TQString &uid, int presence);
            /**
             * Lets outsiders tell us to emit presenceChanged signal.
             */
            void emitContactPresenceChanged(const TQString &uid);

            bool addContact( const TQString &contactId, const TQString &protocolId );

        protected:
            Addressbook();

            static Addressbook *m_instance;
    };

    static KStaticDeleter<Addressbook> sd;

}
#endif