~ubuntu-branches/ubuntu/saucy/kopete/saucy-proposed

« back to all changes in this revision

Viewing changes to protocols/irc/irccontact.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-06-21 02:22:39 UTC
  • Revision ID: package-import@ubuntu.com-20130621022239-63l3zc8p0nf26pt6
Tags: upstream-4.10.80
ImportĀ upstreamĀ versionĀ 4.10.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    irccontact.h - IRC Contact
 
3
 
 
4
    Copyright (c) 2002      by Nick Betcher <nbetcher@kde.org>
 
5
    Copyright (c) 2003      by Jason Keirstead <jason@keirstead.org>
 
6
    Copyright (c) 2003-2007 by Michel Hermier <michel.hermier@gmail.com>
 
7
 
 
8
    Kopete    (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
 
9
 
 
10
    *************************************************************************
 
11
    *                                                                       *
 
12
    * This program is free software; you can redistribute it and/or modify  *
 
13
    * it under the terms of the GNU General Public License as published by  *
 
14
    * the Free Software Foundation; either version 2 of the License, or     *
 
15
    * (at your option) any later version.                                   *
 
16
    *                                                                       *
 
17
    *************************************************************************
 
18
*/
 
19
 
 
20
#ifndef IRCCONTACT_H
 
21
#define IRCCONTACT_H
 
22
 
 
23
#include "ircconst.h"
 
24
 
 
25
#include "kircglobal.h"
 
26
 
 
27
#include "kopetecontact.h"
 
28
#include "kopetemessage.h"
 
29
 
 
30
#include <QMap>
 
31
 
 
32
class IRCAccount;
 
33
 
 
34
namespace KIrc
 
35
{
 
36
class ClientSocket;
 
37
}
 
38
 
 
39
namespace Kopete
 
40
{
 
41
class ChatSession;
 
42
class MetaContact;
 
43
}
 
44
 
 
45
 
 
46
class QTextCodec;
 
47
 
 
48
/**
 
49
 * @author Jason Keirstead <jason@keirstead.org>
 
50
 * @author Michel Hermier <michel.hermier@gmail.com>
 
51
 */
 
52
class IRCContact
 
53
        : public Kopete::Contact
 
54
{
 
55
        Q_OBJECT
 
56
 
 
57
public:
 
58
        typedef QList<IRCContact *> List;
 
59
 
 
60
        IRCContact(IRCAccount *account, const KIrc::EntityPtr &entity,
 
61
                Kopete::MetaContact *metac = 0, const QString& icon = QString());
 
62
        ~IRCContact();
 
63
 
 
64
        IRCAccount *ircAccount() const;
 
65
        KIrc::ClientSocket *kircClient() const;
 
66
 
 
67
        QString caption() const;
 
68
 
 
69
        KIrc::EntityPtr entity() const;
 
70
 
 
71
        /**
 
72
         * This function attempts to find the nickname specified within the current chat
 
73
         * session. Returns a pointer to that IRCUserContact, or 0L if the user does not
 
74
         * exist in this session. More useful for channels. Calling IRCChannelContact::locateUser()
 
75
         * for example tells you if a user is in a certain channel.
 
76
         */
 
77
        Kopete::Contact *locateUser(const QString &nickName);
 
78
 
 
79
        bool isReachable();
 
80
 
 
81
        /**
 
82
         * return true if the contact is in a chat. false if the contact is in no chats
 
83
         * that loop over all manager, and checks the presence of the user
 
84
         */
 
85
        bool isChatting( Kopete::ChatSession *avoid = 0L ) const;
 
86
 
 
87
        Kopete::ChatSession *manager(CanCreateFlags cancreate = CannotCreate);
 
88
        Kopete::ChatSession *chatSession(IRC::ChatSessionType type = IRC::SERVER, CanCreateFlags cancreate = CannotCreate);
 
89
 
 
90
        void appendMessage(Kopete::Message &);
 
91
 
 
92
        QTextCodec *codec();
 
93
 
 
94
        /**
 
95
         * We serialise the contactId and the server group in 'contactId'
 
96
         * so that other IRC programs reading this from KAddressBook have a chance of figuring
 
97
         * which server the contact relates to
 
98
         */
 
99
        void serialize( QMap<QString, QString> &serializedData, QMap<QString, QString> &addressBookData );
 
100
 
 
101
signals:
 
102
        void destroyed(IRCContact *self);
 
103
 
 
104
public slots:
 
105
        void updateStatus();
 
106
 
 
107
        void setCodec(QTextCodec *codec);
 
108
 
 
109
private slots:
 
110
        void entityUpdated();
 
111
 
 
112
        void slotSendMsg(Kopete::Message &message, Kopete::ChatSession *chatSession);
 
113
        QString sendMessage( const QString &msg );
 
114
 
 
115
        void chatSessionDestroyed(Kopete::ChatSession *chatSession);
 
116
 
 
117
        void deleteContact();
 
118
 
 
119
private:
 
120
        Q_DISABLE_COPY(IRCContact)
 
121
 
 
122
        class Private;
 
123
        Private * const d;
 
124
};
 
125
 
 
126
#endif