conf: allow to reject incoming AV conference call (2nd version)
[siplcs.git] / src / core / sipe-core.c
blobdbc7e1343e6456db72eecf6f82ead57e44476abd
1 /**
2 * @file sipe-core.c
4 * pidgin-sipe
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
27 #include <stdlib.h>
29 #include <glib.h>
30 #ifdef HAVE_NSS
31 #include "nss.h"
32 #endif
33 #ifdef HAVE_GMIME
34 #include <gmime/gmime.h>
35 #endif
37 #include "sipe-common.h"
38 #include "sip-csta.h"
39 #include "sip-sec.h"
40 #include "sip-transport.h"
41 #include "sipe-backend.h"
42 #include "sipe-chat.h"
43 #include "sipe-conf.h"
44 #include "sipe-core.h"
45 #include "sipe-core-private.h"
46 #include "sipe-nls.h"
47 #include "sipe-session.h"
48 #include "sipe-subscriptions.h"
49 #include "sipe-media.h"
50 #include "sipe.h"
52 /* locale_dir is unused if ENABLE_NLS is not defined */
53 void sipe_core_init(SIPE_UNUSED_PARAMETER const char *locale_dir)
55 srand(time(NULL));
56 sip_sec_init();
58 #ifdef ENABLE_NLS
59 SIPE_DEBUG_INFO("bindtextdomain = %s",
60 bindtextdomain(PACKAGE_NAME, locale_dir));
61 SIPE_DEBUG_INFO("bind_textdomain_codeset = %s",
62 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"));
63 textdomain(PACKAGE_NAME);
64 #endif
65 #ifdef HAVE_NSS
66 if (!NSS_IsInitialized()) {
67 NSS_NoDB_Init(".");
68 SIPE_DEBUG_INFO_NOFORMAT("NSS initialised");
70 #endif
71 #ifdef HAVE_GMIME
72 g_mime_init(0);
73 #endif
76 void sipe_core_destroy(void)
78 sipe_chat_destroy();
79 #ifdef HAVE_NSS
80 /* do nothing.
81 * We don't want accedently switch off NSS possibly used by other plugin -
82 * ssl-nss in Pidgin for example.
84 #endif
85 #ifdef HAVE_GMIME
86 g_mime_shutdown();
87 #endif
88 sip_sec_destroy();
91 gchar *sipe_core_about(void)
93 return g_strdup_printf(
95 * Non-translatable parts, like markup, are hard-coded
96 * into the format string. This requires more translatable
97 * texts but it makes the translations less error prone.
99 "<b><font size=\"+1\">SIPE " PACKAGE_VERSION " </font></b><br/>"
100 "<br/>"
101 /* 1 */ "%s:<br/>"
102 "<li> - MS Office Communications Server 2007 R2</li><br/>"
103 "<li> - MS Office Communications Server 2007</li><br/>"
104 "<li> - MS Live Communications Server 2005</li><br/>"
105 "<li> - MS Live Communications Server 2003</li><br/>"
106 "<li> - Reuters Messaging</li><br/>"
107 "<br/>"
108 /* 2 */ "%s: <a href=\"" PACKAGE_URL "\">" PACKAGE_URL "</a><br/>"
109 /* 3,4 */ "%s: <a href=\"http://sourceforge.net/projects/sipe/forums/forum/688534\">%s</a><br/>"
110 /* 5,6 */ "%s: <a href=\"" PACKAGE_BUGREPORT "\">%s</a><br/>"
111 /* 7 */ "%s: <a href=\"https://transifex.net/projects/p/pidgin-sipe/c/mob-branch/\">Transifex.net</a><br/>"
112 /* 8 */ "%s: GPLv2+<br/>"
113 "<br/>"
114 /* 9 */ "%s:<br/>"
115 " - CERN<br/>"
116 " - Reuters Messaging network<br/>"
117 " - Deutsche Bank<br/>"
118 " - Merrill Lynch<br/>"
119 " - Wachovia<br/>"
120 " - Intel<br/>"
121 " - Nokia<br/>"
122 " - HP<br/>"
123 " - Symantec<br/>"
124 " - Accenture<br/>"
125 " - Capgemini<br/>"
126 " - Siemens<br/>"
127 " - Alcatel-Lucent<br/>"
128 " - BT<br/>"
129 "<br/>"
130 /* 10,11 */ "%s<a href=\"https://transifex.net/projects/p/pidgin-sipe/c/mob-branch/\">Transifex.net</a>%s.<br/>"
131 "<br/>"
132 /* 12 */ "<b>%s:</b><br/>"
133 " - Anibal Avelar<br/>"
134 " - Gabriel Burt<br/>"
135 " - Stefan Becker<br/>"
136 " - pier11<br/>"
137 " - Jakub Adam<br/>"
138 " - Tomáš Hrabčík<br/>"
139 "<br/>"
140 /* 13 */ "%s<br/>"
142 /* The next 13 texts make up the SIPE about note text */
143 /* About note, part 1/13: introduction */
144 _("A third-party plugin implementing extended version of SIP/SIMPLE used by various products"),
145 /* About note, part 2/13: home page URL (label) */
146 _("Home"),
147 /* About note, part 3/13: support forum URL (label) */
148 _("Support"),
149 /* About note, part 4/13: support forum name (hyperlink text) */
150 _("Help Forum"),
151 /* About note, part 5/13: bug tracker URL (label) */
152 _("Report Problems"),
153 /* About note, part 6/13: bug tracker URL (hyperlink text) */
154 _("Bug Tracker"),
155 /* About note, part 7/13: translation service URL (label) */
156 _("Translations"),
157 /* About note, part 8/13: license type (label) */
158 _("License"),
159 /* About note, part 9/13: known users */
160 _("We support users in such organizations as"),
161 /* About note, part 10/13: translation request, text before Transifex.net URL */
162 /* append a space if text is not empty */
163 _("Please help us to translate SIPE to your native language here at "),
164 /* About note, part 11/13: translation request, text after Transifex.net URL */
165 /* start with a space if text is not empty */
166 _(" using convenient web interface"),
167 /* About note, part 12/13: author list (header) */
168 _("Authors"),
169 /* About note, part 13/13: Localization credit */
170 /* PLEASE NOTE: do *NOT* simply translate the english original */
171 /* but write something similar to the following sentence: */
172 /* "Localization for <language name> (<language code>): <name>" */
173 _("Original texts in English (en): SIPE developers")
177 void sipe_core_deallocate(struct sipe_core_public *sipe_public)
179 struct sipe_core_private *sipe_private = SIPE_CORE_PRIVATE;
180 struct sipe_account_data *sip = SIPE_ACCOUNT_DATA_PRIVATE;
182 #ifdef HAVE_VV
183 if (sipe_private->media_call) {
184 sipe_media_handle_going_offline(sipe_private->media_call);
186 #endif
188 /* leave all conversations */
189 if (sipe_private->sessions) {
190 GSList *entry;
191 while ((entry = sipe_private->sessions) != NULL) {
192 sipe_session_close(sipe_private, entry->data);
196 sipe_conf_cancel_unaccepted(sipe_private, NULL);
198 if (sip->csta) {
199 sip_csta_close(sipe_private);
202 if (sipe_backend_connection_is_valid(SIPE_CORE_PUBLIC)) {
203 sipe_subscriptions_unsubscribe(sipe_private);
204 sip_transport_deregister(sipe_private);
207 sipe_connection_cleanup(sipe_private);
208 g_free(sipe_private->public.sip_name);
209 g_free(sipe_private->public.sip_domain);
210 g_free(sipe_private->username);
211 g_free(sip->email);
212 g_free(sip->password);
213 g_free(sip->authdomain);
214 g_free(sip->authuser);
215 g_free(sip->status);
216 g_free(sip->note);
217 g_free(sip->user_states);
219 sipe_buddy_free_all(sipe_private);
220 g_hash_table_destroy(sipe_private->buddies);
221 g_hash_table_destroy(sip->our_publications);
222 g_hash_table_destroy(sip->user_state_publications);
223 sipe_subscriptions_destroy(sipe_private);
225 if (sip->groups) {
226 GSList *entry = sip->groups;
227 while (entry) {
228 struct sipe_group *group = entry->data;
229 g_free(group->name);
230 g_free(group);
231 entry = entry->next;
234 g_slist_free(sip->groups);
236 if (sip->our_publication_keys) {
237 GSList *entry = sip->our_publication_keys;
238 while (entry) {
239 g_free(entry->data);
240 entry = entry->next;
243 g_slist_free(sip->our_publication_keys);
245 #ifdef HAVE_VV
246 g_free(sipe_private->mras_uri);
247 g_free(sipe_private->media_relay_username);
248 g_free(sipe_private->media_relay_password);
249 sipe_media_relay_list_free(sipe_private->media_relays);
250 #endif
252 g_free(sip);
253 g_free(sipe_private);
257 Local Variables:
258 mode: c
259 c-file-style: "bsd"
260 indent-tabs-mode: t
261 tab-width: 8
262 End: