audio: rename sipe_media_incoming_invite() -> process_incoming_invite_call()
[siplcs.git] / src / core / sipe-core.c
blobe2a1589bb75cafedb213ae03ea75d51b1d758965
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 "sip-csta.h"
38 #include "sip-sec.h"
39 #include "sip-transport.h"
40 #include "sipe-backend.h"
41 #include "sipe-core.h"
42 #include "sipe-core-private.h"
43 #include "sipe-nls.h"
44 #include "sipe-session.h"
45 #include "sipe-subscriptions.h"
46 #include "sipe.h"
48 void sipe_core_init(const char *locale_dir)
50 srand(time(NULL));
51 sip_sec_init();
53 #ifdef ENABLE_NLS
54 SIPE_DEBUG_INFO("bindtextdomain = %s",
55 bindtextdomain(PACKAGE_NAME, locale_dir));
56 SIPE_DEBUG_INFO("bind_textdomain_codeset = %s",
57 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"));
58 textdomain(PACKAGE_NAME);
59 #endif
60 #ifdef HAVE_NSS
61 if (!NSS_IsInitialized()) {
62 NSS_NoDB_Init(".");
63 SIPE_DEBUG_INFO_NOFORMAT("NSS initialised");
65 #endif
66 #ifdef HAVE_GMIME
67 g_mime_init(0);
68 #endif
71 void sipe_core_destroy(void)
73 #ifdef HAVE_NSS
74 /* do nothing.
75 * We don't want accedently switch off NSS possibly used by other plugin -
76 * ssl-nss in Pidgin for example.
78 #endif
79 #ifdef HAVE_GMIME
80 g_mime_shutdown();
81 #endif
82 sip_sec_destroy();
85 gchar *sipe_core_about(void)
87 return g_strdup_printf(
89 * Non-translatable parts, like markup, are hard-coded
90 * into the format string. This requires more translatable
91 * texts but it makes the translations less error prone.
93 "<b><font size=\"+1\">SIPE " PACKAGE_VERSION " </font></b><br/>"
94 "<br/>"
95 /* 1 */ "%s:<br/>"
96 "<li> - MS Office Communications Server 2007 R2</li><br/>"
97 "<li> - MS Office Communications Server 2007</li><br/>"
98 "<li> - MS Live Communications Server 2005</li><br/>"
99 "<li> - MS Live Communications Server 2003</li><br/>"
100 "<li> - Reuters Messaging</li><br/>"
101 "<br/>"
102 /* 2 */ "%s: <a href=\"" PACKAGE_URL "\">" PACKAGE_URL "</a><br/>"
103 /* 3,4 */ "%s: <a href=\"http://sourceforge.net/projects/sipe/forums/forum/688534\">%s</a><br/>"
104 /* 5,6 */ "%s: <a href=\"" PACKAGE_BUGREPORT "\">%s</a><br/>"
105 /* 7 */ "%s: <a href=\"https://transifex.net/projects/p/pidgin-sipe/c/mob-branch/\">Transifex.net</a><br/>"
106 /* 8 */ "%s: GPLv2+<br/>"
107 "<br/>"
108 /* 9 */ "%s:<br/>"
109 " - CERN<br/>"
110 " - Reuters Messaging network<br/>"
111 " - Deutsche Bank<br/>"
112 " - Merrill Lynch<br/>"
113 " - Wachovia<br/>"
114 " - Intel<br/>"
115 " - Nokia<br/>"
116 " - HP<br/>"
117 " - Symantec<br/>"
118 " - Accenture<br/>"
119 " - Capgemini<br/>"
120 " - Siemens<br/>"
121 " - Alcatel-Lucent<br/>"
122 " - BT<br/>"
123 "<br/>"
124 /* 10,11 */ "%s<a href=\"https://transifex.net/projects/p/pidgin-sipe/c/mob-branch/\">Transifex.net</a>%s.<br/>"
125 "<br/>"
126 /* 12 */ "<b>%s:</b><br/>"
127 " - Anibal Avelar<br/>"
128 " - Gabriel Burt<br/>"
129 " - Stefan Becker<br/>"
130 " - pier11<br/>"
131 " - Jakub Adam<br/>"
132 " - Tomáš Hrabčík<br/>"
133 "<br/>"
134 /* 13 */ "%s<br/>"
136 /* The next 13 texts make up the SIPE about note text */
137 /* About note, part 1/13: introduction */
138 _("A third-party plugin implementing extended version of SIP/SIMPLE used by various products"),
139 /* About note, part 2/13: home page URL (label) */
140 _("Home"),
141 /* About note, part 3/13: support forum URL (label) */
142 _("Support"),
143 /* About note, part 4/13: support forum name (hyperlink text) */
144 _("Help Forum"),
145 /* About note, part 5/13: bug tracker URL (label) */
146 _("Report Problems"),
147 /* About note, part 6/13: bug tracker URL (hyperlink text) */
148 _("Bug Tracker"),
149 /* About note, part 7/13: translation service URL (label) */
150 _("Translations"),
151 /* About note, part 8/13: license type (label) */
152 _("License"),
153 /* About note, part 9/13: known users */
154 _("We support users in such organizations as"),
155 /* About note, part 10/13: translation request, text before Transifex.net URL */
156 /* append a space if text is not empty */
157 _("Please help us to translate SIPE to your native language here at "),
158 /* About note, part 11/13: translation request, text after Transifex.net URL */
159 /* start with a space if text is not empty */
160 _(" using convenient web interface"),
161 /* About note, part 12/13: author list (header) */
162 _("Authors"),
163 /* About note, part 13/13: Localization credit */
164 /* PLEASE NOTE: do *NOT* simply translate the english original */
165 /* but write something similar to the following sentence: */
166 /* "Localization for <language name> (<language code>): <name>" */
167 _("Original texts in English (en): SIPE developers")
171 void sipe_core_deallocate(struct sipe_core_public *sipe_public)
173 struct sipe_core_private *sipe_private = SIPE_CORE_PRIVATE;
174 struct sipe_account_data *sip = SIPE_ACCOUNT_DATA_PRIVATE;
176 /* leave all conversations */
177 if (sipe_private->sessions) {
178 GSList *entry;
179 while ((entry = sipe_private->sessions) != NULL) {
180 sipe_session_close(sipe_private, entry->data);
184 if (sip->csta) {
185 sip_csta_close(sipe_private);
188 if (sipe_backend_connection_is_valid(SIPE_CORE_PUBLIC)) {
189 sipe_subscriptions_unsubscribe(sipe_private);
190 sip_transport_deregister(sipe_private);
193 sipe_connection_cleanup(sipe_private);
194 g_free(sipe_private->public.sip_name);
195 g_free(sipe_private->public.sip_domain);
196 g_free(sipe_private->username);
197 g_free(sip->email);
198 g_free(sip->password);
199 g_free(sip->authdomain);
200 g_free(sip->authuser);
201 g_free(sip->status);
202 g_free(sip->note);
203 g_free(sip->user_states);
205 sipe_buddy_free_all(sipe_private);
206 g_hash_table_destroy(sipe_private->buddies);
207 g_hash_table_destroy(sip->our_publications);
208 g_hash_table_destroy(sip->user_state_publications);
209 sipe_subscriptions_destroy(sipe_private);
211 if (sip->groups) {
212 GSList *entry = sip->groups;
213 while (entry) {
214 struct sipe_group *group = entry->data;
215 g_free(group->name);
216 g_free(group);
217 entry = entry->next;
220 g_slist_free(sip->groups);
222 if (sip->our_publication_keys) {
223 GSList *entry = sip->our_publication_keys;
224 while (entry) {
225 g_free(entry->data);
226 entry = entry->next;
229 g_slist_free(sip->our_publication_keys);
231 g_free(sip);
232 g_free(sipe_private);
236 Local Variables:
237 mode: c
238 c-file-style: "bsd"
239 indent-tabs-mode: t
240 tab-width: 8
241 End: