source: qutecom-coip/libs/purplewrapper/include/purplewrapper/PurpleWrapper.h @ 125:d648f4cb122f

Last change on this file since 125:d648f4cb122f was 125:d648f4cb122f, checked in by laurent, 3 years ago

wengo => qutecom

File size: 3.2 KB
Line 
1/*
2 * QuteCom, a voice over Internet phone
3 * Copyright (C) 2010 Mbdsys
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19
20#ifndef OWPURPLEWRAPPER_H
21#define OWPURPLEWRAPPER_H
22
23#include <purplewrapper/purplewrapperdll.h>
24
25extern "C" {
26#include <glib.h>
27#include <libpurple/connection.h> //For PurpleConnectionUiOps
28#include <libpurple/conversation.h> //For PurpleConversationUiOps
29}
30
31#include <string>
32
33class Account;
34
35/**
36 * Purple Wrapper.
37 *
38 * @author Philippe Bernery
39 * @author Julien Bossart
40 */
41class PurpleWrapper {
42public:
43
44        PURPLEWRAPPER_API static PurpleWrapper & getInstance();
45
46        /**
47         * Initializes LibPurple.
48         */
49        PURPLEWRAPPER_API void initialize();
50
51        PURPLEWRAPPER_API void uninitialize();
52
53        /**
54         * Sets configPath for LibPurple. Must be called before initialize.
55         * @param configPath set the path to LibPurple configuration.
56         */
57        PURPLEWRAPPER_API void setConfigPath(const std::string & configPath);
58
59        /**
60         * Sets callbacks for connection.
61         */
62        PURPLEWRAPPER_API void setConnectionCallbacks(PurpleConnectionUiOps * connUiOps);
63
64        /**
65         * Sets callbacks for conversation.
66         */
67        PURPLEWRAPPER_API void setConversationCallbacks(PurpleConversationUiOps * convUiOps);
68
69        /**
70         * Sets callbacks for budy list.
71         */
72        PURPLEWRAPPER_API void setBuddyListCallbacks(PurpleBlistUiOps * blistUiOps);
73
74        /**
75         * Sets callbacks for budy list.
76         */
77        PURPLEWRAPPER_API void setAccountCallbacks(PurpleAccountUiOps * accountUiOps);
78
79        /**
80         * Used for signal connection.
81         */
82        PURPLEWRAPPER_API void * getHandle();
83
84        /**
85         * Utility function to get the real login of the given account.
86         * LibPurple sometimes adds more information in username field.
87         * (e.g: for Jabber, LibPurple adds the resource in the username field, "login/resource")
88         */
89        PURPLEWRAPPER_API static std::string cleanLogin(PurpleAccount *gAccount);
90
91        /**
92         * Utility function to get the login of the given account, compatible.
93         * with ones used by Purple.
94         * (e.g: for Jabber, LibPurple needs the resource in the username field, "login/resource")
95         */
96        PURPLEWRAPPER_API static std::string purpleLogin(const Account & account);
97
98private:
99
100        PurpleWrapper();
101
102        ~PurpleWrapper();
103
104        void setCallbacks();
105
106        static PurpleWrapper * _instance;
107
108        std::string _configPath;
109
110        /** Connection callbacks. */
111        PurpleConnectionUiOps * _connUiOps;
112
113        /** Conversation callbacks. */
114        PurpleConversationUiOps * _convUiOps;
115
116        /** Buddy list callbacks. */
117        PurpleBlistUiOps * _blistUiOps;
118
119        /** Accounts callbacks. */
120        PurpleAccountUiOps * _accountUiOps;
121
122        bool _isInitialized;
123};
124
125#endif  //OWPURPLEWRAPPER_H
Note: See TracBrowser for help on using the repository browser.