~ubuntu-branches/ubuntu/edgy/kopete/edgy-updates

« back to all changes in this revision

Viewing changes to kopete/protocols/msn/msninvitation.h

  • Committer: Bazaar Package Importer
  • Author(s): Harald Sitter
  • Date: 2006-06-12 21:32:28 UTC
  • Revision ID: james.westby@ubuntu.com-20060612213228-d823h1niurgb7pfg
Tags: upstream-3.5.3+kopete0.12.0
ImportĀ upstreamĀ versionĀ 3.5.3+kopete0.12.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    msninvitation.cpp
 
3
 
 
4
    Copyright (c) 2003 by Olivier Goffart        <ogoffart @ kde.org>
 
5
 
 
6
    Kopete    (c) 2003 by the Kopete developers  <kopete-devel@kde.org>
 
7
 
 
8
    *************************************************************************
 
9
    *                                                                       *
 
10
    * This program is free software; you can redistribute it and/or modify  *
 
11
    * it under the terms of the GNU General Public License as published by  *
 
12
    * the Free Software Foundation; either version 2 of the License, or     *
 
13
    * (at your option) any later version.                                   *
 
14
    *                                                                       *
 
15
    *************************************************************************
 
16
*/
 
17
#ifndef MSNINVITATION_H
 
18
#define MSNINVITATION_H
 
19
 
 
20
#include <qstring.h>
 
21
 
 
22
#include "kopete_export.h"
 
23
 
 
24
class QObject;
 
25
 
 
26
/**
 
27
 * @author Olivier Goffart
 
28
 *
 
29
 * The invitation is the base class which handle an MSN invitation.
 
30
 * The implemented class must to herits from QObject too.
 
31
 * You can accept the invitation by catching @ref MSNProtocol::invitation() signals
 
32
 * or create one and insert it to a kmm with @ref MSNChatSession::initInvitation()
 
33
 * you can add action with @ref Kopete::Plugin::customChatActions()
 
34
 */
 
35
class KOPETE_EXPORT MSNInvitation
 
36
{
 
37
public:
 
38
        /**
 
39
         * Constructor
 
40
         * @param incoming say if it is an incoming invitation
 
41
         * @param applicationID is the exadecimal id of the invitation
 
42
         * @param applicationName is a i18n'ed string of the name of the application
 
43
         */
 
44
        MSNInvitation(bool incoming,const QString &applicationID , const QString &applicationName);
 
45
        virtual ~MSNInvitation();
 
46
 
 
47
        /**
 
48
         * @internal
 
49
         * it is a reject invitation because the invitation is not implemented
 
50
         */
 
51
        static QCString unimplemented(long unsigned int cookie);
 
52
 
 
53
        /**
 
54
         * you can set manualy the cookie. note that a cookie is automatically generated when a new
 
55
         * invitation is created, or in @ref parseInvitation
 
56
         */
 
57
        void setCookie( long unsigned int c ) { m_cookie = c; }
 
58
        /**
 
59
         * @return the cookie
 
60
         */
 
61
        long unsigned int cookie() { return m_cookie; }
 
62
 
 
63
        /**
 
64
         * @return true if it is an incommijng invitation
 
65
         */
 
66
        bool incoming() { return m_incoming; }
 
67
 
 
68
 
 
69
        /**
 
70
         * reimplement this. this is the invitation string used in @ref MSNChatSession::initInvitation()
 
71
         * the default implementation return the common begin.
 
72
         * You can also set the state to Invited (the default implementation do that)
 
73
         */
 
74
        virtual QString invitationHead();
 
75
 
 
76
        /**
 
77
         * This is the reject invitation string
 
78
         * @param rejectcode is the code, it can be "REJECT" or "TIMEOUT"
 
79
         */
 
80
        QCString rejectMessage(const QString & rejectcode = "REJECT");
 
81
 
 
82
        /**
 
83
         * reimplement this method. it is called when an invitation message with the invitation's cookie is received
 
84
         * the default implementation parse the cookie, or the reject message
 
85
         */
 
86
        virtual void parseInvitation(const QString& invitation);
 
87
 
 
88
        /**
 
89
         * return the qobject (this)
 
90
         */
 
91
        virtual QObject* object()=0;
 
92
//signals:
 
93
        /**
 
94
         * reimplement this as a signal, and emit it when the invitation has to be destroyed.
 
95
         * don't delete the invitation yourself
 
96
         */
 
97
        virtual void done(MSNInvitation*)=0;
 
98
 
 
99
        /**
 
100
         * This indiquate the state. it is going to be completed later
 
101
         * - Nothing means than nothing has been done in the invitaiton (nothing has been sent/received)
 
102
         * - Invited means than the invitaiton has been sent
 
103
         */
 
104
        enum State { Nothing=0 , Invited=1 };
 
105
        /**
 
106
         * retrun the current state
 
107
         */
 
108
        State state();
 
109
        /**
 
110
         * set the current State
 
111
         */
 
112
        void setState(State);
 
113
 
 
114
 
 
115
 
 
116
protected:
 
117
        bool m_incoming;
 
118
        long unsigned int m_cookie;
 
119
        QString m_applicationId;
 
120
        QString m_applicationName;
 
121
        State m_state;
 
122
 
 
123
 
 
124
};
 
125
 
 
126
#endif