Remove redundant NULL checks
[pidgin-git.git] / pidgin / gtkdialogs.c
blob407e20a6f9083f3de9ad9ab4b5996be4ebf3825a
1 /*
2 * @file gtkdialogs.c GTK+ Dialogs
3 * @ingroup pidgin
4 */
6 /* pidgin
8 * Pidgin is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
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.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 #define _PIDGIN_GTKDIALOGS_C_
28 #include "internal.h"
29 #include "pidgin.h"
30 #include "package_revision.h"
32 #include "debug.h"
33 #include "notify.h"
34 #include "plugin.h"
35 #include "prpl.h"
36 #include "request.h"
37 #include "util.h"
38 #include "core.h"
40 #include "gtkblist.h"
41 #include "gtkdialogs.h"
42 #include "gtkimhtml.h"
43 #include "gtkimhtmltoolbar.h"
44 #include "gtklog.h"
45 #include "gtkutils.h"
46 #include "pidginstock.h"
48 static GList *dialogwindows = NULL;
50 struct _PidginGroupMergeObject {
51 PurpleGroup* parent;
52 char *new_name;
55 struct developer {
56 char *name;
57 char *role;
58 char *email;
61 struct translator {
62 char *language;
63 char *abbr;
64 char *name;
65 char *email;
68 struct artist {
69 char *name;
70 char *email;
73 /* Order: Alphabetical by Last Name */
74 static const struct developer developers[] = {
75 {"Daniel 'datallah' Atallah", NULL, NULL},
76 {"Paul 'darkrain42' Aurich", NULL, NULL},
77 {"Ethan 'Paco-Paco' Blanton", NULL, NULL},
78 {"Hylke Bons", N_("artist"), "hylkebons@gmail.com"},
79 {"Sadrul Habib Chowdhury", NULL, NULL},
80 {"Mark 'KingAnt' Doliner", NULL, "mark@kingant.net"},
81 {"Gary 'grim' Kramlich", NULL, "grim@pidgin.im"},
82 {"Richard 'rlaager' Laager", NULL, "rlaager@pidgin.im"},
83 {"Marcus 'malu' Lundblad", NULL, NULL},
84 {"Sulabh 'sulabh_m' Mahajan", NULL, NULL},
85 {"Richard 'wabz' Nelson", NULL, NULL},
86 {"Etan 'deryni' Reisner", NULL, NULL},
87 {"Michael 'Maiku' Ruprecht", N_("voice and video"), NULL},
88 {"Elliott 'QuLogic' Sales de Andrade", NULL, NULL},
89 {"Luke 'LSchiere' Schierer", N_("support"), "lschiere@users.sf.net"},
90 {"Evan Schoenberg", NULL, NULL},
91 {"Kevin 'SimGuy' Stange", N_("webmaster"), NULL},
92 {"Will 'resiak' Thompson", NULL, NULL},
93 {"Stu 'nosnilmot' Tomlinson", NULL, NULL},
94 {"Jorge 'Masca' Villaseñor", NULL, NULL},
95 {"Tomasz Wasilczyk", NULL, "https://www.wasilczyk.pl"},
96 {NULL, NULL, NULL}
99 /* Order: Alphabetical by Last Name */
100 static const struct developer patch_writers[] = {
101 {"Jakub 'haakon' Adam", NULL, NULL},
102 {"Krzysztof Klinikowski", NULL, NULL},
103 {"Eion Robb", NULL, NULL},
104 {NULL, NULL, NULL}
107 /* Order: Alphabetical by Last Name */
108 static const struct developer retired_developers[] = {
109 {"John 'rekkanoryo' Bailey", NULL, NULL},
110 {"Herman Bloggs", N_("win32 port"), "herman@bluedigits.com"},
111 {"Thomas Butter", NULL, NULL},
112 /* Translators: This is a person's name. For most languages we recommend
113 not translating it. */
114 {N_("Ka-Hing Cheung"), NULL, NULL},
115 {"Jim Duchek", N_("maintainer"), "jim@linuxpimps.com"},
116 {"Sean Egan", NULL, "sean.egan@gmail.com"},
117 {"Rob Flynn", N_("maintainer"), NULL},
118 {"Adam Fritzler", N_("libfaim maintainer"), NULL},
119 {"Christian 'ChipX86' Hammond", N_("webmaster"), NULL},
120 {"Casey Harkins", NULL, NULL},
121 {"Ivan Komarov", NULL, "ivan.komarov@pidgin.im"},
122 /* If "lazy bum" translates literally into a serious insult, use something else or omit it. */
123 {"Syd Logan", N_("hacker and designated driver [lazy bum]"), NULL},
124 {"Christopher 'siege' O'Brien", NULL, "taliesein@users.sf.net"},
125 {"Bartosz Oler", NULL, NULL},
126 {"Tim 'marv' Ringenbach", NULL, NULL},
127 {"Megan 'Cae' Schneider", N_("support/QA"), NULL},
128 {"Jim Seymour", N_("XMPP"), NULL},
129 {"Mark Spencer", N_("original author"), "markster@marko.net"},
130 {"Nathan 'faceprint' Walp", NULL, NULL},
131 {"Eric Warmenhoven", N_("lead developer"), "warmenhoven@yahoo.com"},
132 {NULL, NULL, NULL}
135 /* Order: Alphabetical by Last Name */
136 static const struct developer retired_patch_writers[] = {
137 {"Felipe 'shx' Contreras", NULL, NULL},
138 {"Decklin Foster", NULL, NULL},
139 {"Peter 'Bleeter' Lawler", NULL, NULL},
140 {"Robert 'Robot101' McQueen", NULL, NULL},
141 {"Benjamin Miller", NULL, NULL},
142 {"Dennis 'EvilDennisR' Ristuccia", N_("Senior Contributor/QA"), NULL},
143 {"Peter 'Fmoo' Ruibal", NULL, NULL},
144 {"Gabriel 'Nix' Schulhof", NULL, NULL},
145 {NULL, NULL, NULL}
148 /* Order: Code, then Alphabetical by Last Name */
149 static const struct translator translators[] = {
150 {N_("Afrikaans"), "af", "Samuel Murray", "afrikaans@gmail.com"},
151 {N_("Afrikaans"), "af", "Friedel Wolff", "friedel@translate.org.za"},
152 {N_("Arabic"), "ar", "Khaled Hosny", "khaledhosny@eglug.org"},
153 {N_("Assamese"), "as", "Amitakhya Phukan", "aphukan@fedoraproject.org"},
154 {N_("Asturian"), "ast", "Llumex03", "l.lumex03.tornes@gmail.com"},
155 {N_("Belarusian Latin"), "be@latin", "Ihar Hrachyshka", "ihar.hrachyshka@gmail.com"},
156 {N_("Bulgarian"), "bg", "Vladimira Girginova", "missing@here.is"},
157 {N_("Bulgarian"), "bg", "Vladimir (Kaladan) Petkov", "kaladan@gmail.com"},
158 {N_("Bengali"), "bn", "Jamil Ahmed", "jamil@bengalinux.org"},
159 {N_("Bengali"), "bn", "Israt Jahan", "israt@ankur.org.bd"},
160 {N_("Bengali"), "bn", "Samia Nimatullah", "mailsamia2001@yahoo.com"},
161 {N_("Bengali-India"), "bn_IN", "Runa Bhattacharjee", "runab@fedoraproject.org"},
162 {N_("Breton"), "br", "Gwenn Meynier", "tornoz@laposte.net"},
163 {N_("Bodo"), "brx", "Chandrakant Dhutadmal", "cpdhutadmal@yahoo.com"},
164 {N_("Bosnian"), "bs", "Lejla Hadzialic", "lejlah@gmail.com"},
165 {N_("Catalan"), "ca", "Josep Puigdemont", "josep.puigdemont@gmail.com"},
166 {N_("Valencian-Catalan"), "ca@valencia", "Toni Hermoso", "toniher@softcatala.org"},
167 {N_("Valencian-Catalan"), "ca@valencia", "Josep Puigdemont", "tradgnome@softcatala.org"},
168 {N_("Czech"), "cs", "David Vachulka", "david@konstrukce-cad.com"},
169 {N_("Danish"), "da", "Nicky Thomassen", "nicky@aptget.dk"},
170 {N_("German"), "de", "Björn Voigt", "bjoernv@arcor.de"},
171 {N_("Dzongkha"), "dz", "Norbu", "nor_den@hotmail.com"},
172 {N_("Dzongkha"), "dz", "Jurmey Rabgay", "jur_gay@yahoo.com"},
173 {N_("Dzongkha"), "dz", "Wangmo Sherpa", "rinwanshe@yahoo.com"},
174 {N_("Greek"), "el", "Katsaloulis Panayotis", "panayotis@panayotis.com"},
175 {N_("Greek"), "el", "Panos Bouklis", "panos@echidna-band.com"},
176 {N_("Australian English"), "en_AU", "Michael Findlay", "keltoiboy@gmail.com"},
177 {N_("British English"), "en_GB", "Phil Hannent", "phil@hannent.co.uk"},
178 {N_("Canadian English"), "en_CA", "Adam Weinberger", "adamw@gnome.org"},
179 {N_("Esperanto"), "eo", "Stéphane Fillod", "fillods@users.sourceforge.net"},
180 {N_("Spanish"), "es", "Javier Fernández-Sanguino Peña", "jfs@debian.org"},
181 {N_("Argentine Spanish"), "es_AR", "KNTRO", "tskuhn@gmail.com"},
182 {N_("Estonian"), "et", "Ivar Smolin", "okul@linux.ee"},
183 {N_("Basque"), "eu", "Mikel Pascual Aldabaldetreku", "mikel.paskual@gmail.com"},
184 {N_("Persian"), "fa", "Elnaz Sarbar", "elnaz@farsiweb.info"},
185 {N_("Persian"), "fa", "Roozbeh Pournader", "roozbeh@farsiweb.info"},
186 {N_("Persian"), "fa", "Meelad Zakaria", "meelad@farsiweb.info"},
187 {N_("Finnish"), "fi", "Timo Jyrinki", "timo.jyrinki@iki.fi"},
188 {N_("Irish"), "ga", "Aaron Kearns", "ajkearns6@gmail.com"},
189 {N_("Irish"), "ga", "Kevin Scannell", NULL},
190 {N_("Galician"), "gl", "Mar Castro", "mariamarcp@gmail.com"},
191 {N_("Galician"), "gl", "Frco. Javier Rial", "fjrial@cesga.es"},
192 {N_("Gujarati"), "gu", "Ankit Patel", "ankit_patel@users.sf.net"},
193 {N_("Gujarati"), "gu", N_("Gujarati Language Team"), "indianoss-gujarati@lists.sourceforge.net"},
194 {N_("Hebrew"), "he", "Shalom Craimer", "scraimer@gmail.com"},
195 {N_("Hindi"), "hi", "Sangeeta Kumari", "sangeeta_0975@yahoo.com"},
196 {N_("Hindi"), "hi", "Rajesh Ranjan", "rajeshkajha@yahoo.com"},
197 {N_("Croatian"), "hr", "Sabina Drempetić", "bina91991@googlemail.com"},
198 {N_("Hungarian"), "hu", "Kelemen Gábor", "kelemeng@gnome.hu"},
199 {N_("Indonesian"), "id", "Rai S. Regawa", "raireg@yahoo.com"},
200 {N_("Italian"), "it", "Claudio Satriano", "satriano@gmail.com"},
201 {N_("Japanese"), "ja", "Takayuki Kusano", "AE5T-KSN@asahi-net.or.jp"},
202 {N_("Georgian"), "ka", N_("Ubuntu Georgian Translators"), "alexander.didebulidze@stusta.mhn.de"},
203 {N_("Kazakh"), "kk", "Baurzhan Muftakhidinov", "baurthefirst@gmail.com"},
204 {N_("Khmer"), "km", "Khoem Sokhem", "khoemsokhem@khmeros.info"},
205 {N_("Kannada"), "kn", N_("Kannada Translation team"), "translation@sampada.info"},
206 {N_("Korean"), "ko", "Sushizang", "sushizang@empal.com"},
207 {N_("Kashmiri"), "kas", "Chandrakant Dhutadmal", "cpdhutadmal@yahoo.com"},
208 {N_("Kurdish"), "ku", "Amed Ç. Jiyan", "amedcj@hotmail.com"},
209 {N_("Kurdish"), "ku", "Erdal Ronahi", "erdal.ronahi@gmail.com"},
210 {N_("Kurdish"), "ku", "Rizoyê Xerzî", "rizoxerzi@hotmail.com"},
211 {N_("Kurdish (Sorani)"), "ku_IQ", "Haval A. Ahmed", "haval.abdulkarim@gmail.com"},
212 {N_("Lithuanian"), "lt", "Algimantas Margevičius", "margevicius.algimantas@gmail.com"},
213 {N_("Latvian"), "lv", "Rudolfs Mazurs", "rudolfs.mazurs@gmail.com"},
214 {N_("Latvian"), "lv", "Ingmārs Dīriņš", "melhiors14@gmail.com"},
215 {N_("Maithili"), "mai", "Sangeeta Kumari", "sangeeta_0975@yahoo.com"},
216 {N_("Maithili"), "mai", "Rajesh Ranjan", "rajeshkajha@yahoo.com"},
217 {N_("Meadow Mari"), "mhr", "David Preece", "davidpreece1@gmail.com"},
218 {N_("Macedonian"), "mk", "Arangel Angov ", "arangel@linux.net.mk"},
219 {N_("Macedonian"), "mk", "Ivana Kirkovska", "ivana.kirkovska@gmail.com"},
220 {N_("Macedonian"), "mk", "Jovan Naumovski", "jovan@lugola.net"},
221 {N_("Malay"), "ms_MY", "abuyop", "abuyop@gmail.com"},
222 {N_("Malayalam"), "ml", "Ani Peter", "apeter@redhat.com"},
223 {N_("Mongolian"), "mn", "gooyo", NULL},
224 {N_("Marathi"), "mr", "Sandeep Shedmake", "sandeep.shedmake@gmail.com"},
225 {N_("Burmese"), "my_MM", "Thura Hlaing", "trhura@gmail.com"},
226 {N_("Bokmål Norwegian"), "nb", "Allan Nordhøy", "epost@anotheragency.no"},
227 {N_("Nepali"), "ne", "Saroj Dhakal", "lotusnagarkot@gmail.com"},
228 {N_("Dutch, Flemish"), "nl", "Gideon van Melle", "translations@gvmelle.com"},
229 {N_("Norwegian Nynorsk"), "nn", "Yngve Spjeld Landro", "l10n@landro.net"},
230 {N_("Occitan"), "oc", "Cédric Valmary", "cvalmary@yahoo.fr"},
231 {N_("Oriya"), "or", "Manoj Kumar Giri", "giri.manojkr@gmail.com"},
232 {N_("Punjabi"), "pa", "Amanpreet Singh Alam", "aalam@users.sf.net"},
233 {N_("Polish"), "pl", "Piotr Drąg", "piotrdrag@gmail.com"},
234 {N_("Portuguese"), "pt", "Paulo Ribeiro", "paulo@diffraction.pt"},
235 {N_("Portuguese-Brazil"), "pt_BR", "Renato Silva", "br.renatosilva@gmail.com"},
236 {N_("Pashto"), "ps", "Kashif Masood", "masudmails@yahoo.com"},
237 {N_("Romanian"), "ro", "Mișu Moldovan", "dumol@gnome.org"},
238 {N_("Romanian"), "ro", "Andrei Popescu", "andreimpopescu@gmail.com"},
239 {N_("Russian"), "ru", "Антон Самохвалов", "samant.ua@mail.ru"},
240 {N_("Sindhi"), "sd", "Chandrakant Dhutadmal", "cpdhutadmal@yahoo.com"},
241 {N_("Slovak"), "sk", "Jozef Káčer", "quickparser@gmail.com"},
242 {N_("Slovak"), "sk", "loptosko", "loptosko@gmail.com"},
243 {N_("Slovenian"), "sl", "Martin Srebotnjak", "miles@filmsi.net"},
244 {N_("Albanian"), "sq", "Besnik Bleta", "besnik@programeshqip.org"},
245 {N_("Serbian"), "sr", "Miloš Popović", "gpopac@gmail.com"},
246 {N_("Serbian Latin"), "sr@latin", "Miloš Popović", "gpopac@gmail.com"},
247 {N_("Sinhala"), "si", "Yajith Ajantha Dayarathna", "yajith@gmail.com"},
248 {N_("Sinhala"), "si", "Danishka Navin", "snavin@redhat.com"},
249 {N_("Swedish"), "sv", "Josef Andersson", "josef.andersson@gmail.com"},
250 {N_("Swahili"), "sw", "Paul Msegeya", "msegeya@gmail.com"},
251 {N_("Tamil"), "ta", "I. Felix", "ifelix25@gmail.com"},
252 {N_("Tamil"), "ta", "Viveka Nathan K", "vivekanathan@users.sourceforge.net"},
253 {N_("Telugu"), "te", "Krishnababu Krottapalli", "krottapalli@ymail.com"},
254 {N_("Thai"), "th", "Isriya Paireepairit", "markpeak@gmail.com"},
255 {N_("Tatar"), "tt", "ILDAR Valeev", "v_ildar@bk.ru"},
256 {N_("Ukranian"), "uk", "Oleksandr Kovalenko", "alx.kovalenko@gmail.com"},
257 {N_("Urdu"), "ur", "RKVS Raman", "rkvsraman@gmail.com"},
258 {N_("Uzbek"), "uz",
259 /* Translators: This is a person's name. For most languages we recommend
260 not translating it. */
261 N_("Akmal Khushvakov"), "uzbadmin@gmail.com"},
262 {N_("Vietnamese"), "vi", "Nguyễn Vũ Hưng", "vuhung16plus@gmail.com"},
263 {N_("Simplified Chinese"), "zh_CN", "Aron Xu", "happyaron.xu@gmail.com"},
264 {N_("Hong Kong Chinese"), "zh_HK", "Abel Cheung", "abelindsay@gmail.com"},
265 {N_("Hong Kong Chinese"), "zh_HK", "Ambrose C. Li", "acli@ada.dhs.org"},
266 {N_("Hong Kong Chinese"), "zh_HK", "Paladin R. Liu", "paladin@ms1.hinet.net"},
267 {N_("Traditional Chinese"), "zh_TW", "Ambrose C. Li", "acli@ada.dhs.org"},
268 {N_("Traditional Chinese"), "zh_TW", "Paladin R. Liu", "paladin@ms1.hinet.net"},
269 {NULL, NULL, NULL, NULL}
273 static const struct translator past_translators[] = {
274 {N_("Amharic"), "am", "Daniel Yacob", NULL},
275 {N_("Arabic"), "ar", "Mohamed Magdy", "alnokta@yahoo.com"},
276 {N_("Bulgarian"), "bg", "Hristo Todorov", NULL},
277 {N_("Bengali"), "bn", "Indranil Das Gupta", "indradg@l2c2.org"},
278 {N_("Bengali"), "bn", "Tisa Nafisa", "tisa_nafisa@yahoo.com"},
279 {N_("Catalan"), "ca", "JM Pérez Cáncer", NULL},
280 {N_("Catalan"), "ca", "Robert Millan", NULL},
281 {N_("Czech"), "cs", "Honza Král", NULL},
282 {N_("Czech"), "cs", "Miloslav Trmac", "mitr@volny.cz"},
283 {N_("Danish"), "da", "Peter Bach", "bach.peter@gmail.com"},
284 {N_("Danish"), "da", "Morten Brix Pedersen", "morten@wtf.dk"},
285 {N_("German"), "de", "Daniel Seifert, Karsten Weiss", NULL},
286 {N_("German"), "de", "Jochen Kemnade", "jochenkemnade@web.de"},
287 {N_("Australian English"), "en_AU", "Peter Lawler", "trans@six-by-nine.com.au"},
288 {N_("British English"), "en_GB", "Luke Ross", "luke@lukeross.name"},
289 {N_("Spanish"), "es", "JM Pérez Cáncer", NULL},
290 {N_("Spanish"), "es", "Nicolás Lichtmaier", NULL},
291 {N_("Spanish"), "es", "Amaya Rodrigo", NULL},
292 {N_("Spanish"), "es", "Alejandro G Villar", NULL},
293 {N_("Basque"), "eu", "Iñaki Larrañaga Murgoitio", "dooteo@zundan.com"},
294 {N_("Basque"), "eu", "Hizkuntza Politikarako Sailburuordetza", "hizkpol@ej-gv.es"},
295 {N_("Finnish"), "fi", "Arto Alakulju", NULL},
296 {N_("Finnish"), "fi", "Tero Kuusela", NULL},
297 {N_("French"), "fr", "Sébastien François", NULL},
298 {N_("French"), "fr", "Loïc Jeannin", NULL},
299 {N_("French"), "fr", "Stéphane Pontier", NULL},
300 {N_("French"), "fr", "Stéphane Wirtel", NULL},
301 {N_("French"), "fr", "Éric Boumaour", NULL},
302 {N_("Galician"), "gl", "Ignacio Casal Quinteiro", NULL},
303 {N_("Hebrew"), "he", "Pavel Bibergal", NULL},
304 {N_("Hindi"), "hi", "Ravishankar Shrivastava", NULL},
305 {N_("Hungarian"), "hu", "Zoltan Sutto", NULL},
306 {N_("Armenian"), "hy", "David Avsharyan", NULL},
307 {N_("Italian"), "it", "Salvatore di Maggio", NULL},
308 {N_("Japanese"), "ja", "Takashi Aihana", NULL},
309 {N_("Japanese"), "ja", "Ryosuke Kutsuna", NULL},
310 {N_("Japanese"), "ja", "Junichi Uekawa", NULL},
311 {N_("Japanese"), "ja", "Taku Yasui", NULL},
312 {N_("Georgian"), "ka", "Temuri Doghonadze", NULL},
313 {N_("Korean"), "ko", "Sang-hyun S, A Ho-seok Lee", NULL},
314 {N_("Korean"), "ko", "Kyeong-uk Son", NULL},
315 {N_("Lao"), "lo", "Anousak Souphavah", NULL},
316 {N_("Lithuanian"), "lt", "Laurynas Biveinis", "laurynas.biveinis@gmail.com"},
317 {N_("Lithuanian"), "lt", "Gediminas Čičinskas", NULL},
318 {N_("Lithuanian"), "lt", "Andrius Štikonas", NULL},
319 {N_("Macedonian"), "mk", "Tomislav Markovski", NULL},
320 {N_("Malay"), "ms_MY", "Muhammad Najmi bin Ahmad Zabidi", NULL},
321 {N_("Bokmål Norwegian"), "nb", "Hans Fredrik Nordhaug", "hans@nordhaug.priv.no"},
322 {N_("Bokmål Norwegian"), "nb", "Hallvard Glad", "hallvard.glad@gmail.com"},
323 {N_("Bokmål Norwegian"), "nb", "Petter Johan Olsen", NULL},
324 {N_("Bokmål Norwegian"), "nb", "Espen Stefansen", "espenas@gmail.com"},
325 {N_("Nepali"), "ne", "Shyam Krishna Bal", NULL},
326 {N_("Dutch, Flemish"), "nl", "Vincent van Adrighem", "V.vanAdrighem@dirck.mine.nu"},
327 {N_("Occitan"), "oc", "Yannig Marchegay", "yannig@marchegay.org"},
328 {N_("Polish"), "pl", "Krzysztof Foltman", "krzysztof@foltman.com"},
329 {N_("Polish"), "pl", "Paweł Godlewski", "pawel@bajk.pl"},
330 {N_("Polish"), "pl", "Piotr Makowski", NULL},
331 {N_("Polish"), "pl", "Emil Nowak", "emil5@go2.pl"},
332 {N_("Polish"), "pl", "Przemysław Sułek", NULL},
333 {N_("Portuguese"), "pt", "Duarte Henriques", NULL},
334 {N_("Portuguese-Brazil"), "pt_BR", "Maurício de Lemos Rodrigues Collares Neto", "mauricioc@gmail.com"},
335 {N_("Portuguese-Brazil"), "pt_BR", "Rodrigo Luiz Marques Flores", "rodrigomarquesflores@gmail.com"},
336 {N_("Russian"), "ru", "Dmitry Beloglazov", "dmaa@users.sf.net"},
337 {N_("Russian"), "ru", "Alexandre Prokoudine", NULL},
338 {N_("Russian"), "ru", "Sergey Volozhanin", NULL},
339 {N_("Slovak"), "sk", "Daniel Režný", NULL},
340 {N_("Slovak"), "sk", "Richard Golier", NULL},
341 {N_("Slovak"), "sk", "helix84", NULL},
342 {N_("Slovenian"), "sl", "Matjaz Horvat", NULL},
343 {N_("Serbian"), "sr", "Danilo Šegan", "dsegan@gmx.net"},
344 {N_("Serbian"), "sr", "Aleksandar Urosevic", "urke@users.sourceforge.net"},
345 {N_("Swedish"), "sv", "Peter Hjalmarsson", "xake@telia.com"},
346 {N_("Swedish"), "sv", "Tore Lundqvist", NULL},
347 {N_("Swedish"), "sv", "Christian Rose", NULL},
348 {N_("Telugu"), "te", "Mr. Subbaramaih", "info.gist@cdac.in"},
349 {N_("Turkish"), "tr", "Serdar Soytetir", "tulliana@gmail.com"},
350 {N_("Turkish"), "tr", "Ahmet Alp Balkan", NULL},
351 {N_("Vietnamese"), "vi", N_("T.M.Thanh and the Gnome-Vi Team"), "gnomevi-list@lists.sf.net"},
352 {N_("Simplified Chinese"), "zh_CN", "Hashao, Rocky S. Lee", NULL},
353 {N_("Simplified Chinese"), "zh_CN", "Funda Wang", "fundawang@linux.net.cn"},
354 {N_("Traditional Chinese"), "zh_TW", "Hashao, Rocky S. Lee", NULL},
355 {NULL, NULL, NULL, NULL}
358 static void
359 add_developers(GString *str, const struct developer *list)
361 for (; list->name != NULL; list++) {
362 if (list->email != NULL) {
363 const gchar *proto = "mailto:";
364 if (strchr(list->email, ':') != NULL)
365 proto = "";
366 g_string_append_printf(str, " <a href=\"%s%s\">%s</a>%s%s%s<br/>",
367 proto,
368 list->email, _(list->name),
369 list->role ? " (" : "",
370 list->role ? _(list->role) : "",
371 list->role ? ")" : "");
372 } else {
373 g_string_append_printf(str, " %s%s%s%s<br/>",
374 _(list->name),
375 list->role ? " (" : "",
376 list->role ? _(list->role) : "",
377 list->role ? ")" : "");
382 static void
383 add_translators(GString *str, const struct translator *list)
385 for (; list->language != NULL; list++) {
386 if (list->email != NULL) {
387 g_string_append_printf(str, " <b>%s (%s)</b> - <a href=\"mailto:%s\">%s</a><br/>",
388 _(list->language),
389 list->abbr,
390 list->email,
391 _(list->name));
392 } else {
393 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>",
394 _(list->language),
395 list->abbr,
396 _(list->name));
401 void
402 pidgin_dialogs_destroy_all()
404 while (dialogwindows) {
405 gtk_widget_destroy(dialogwindows->data);
406 dialogwindows = g_list_remove(dialogwindows, dialogwindows->data);
410 static void destroy_win(GtkWidget *button, GtkWidget *win)
412 gtk_widget_destroy(win);
415 #if 0
416 /* This function puts the version number onto the pixmap we use in the 'about'
417 * screen in Pidgin. */
418 static void
419 pidgin_logo_versionize(GdkPixbuf **original, GtkWidget *widget) {
420 GdkPixmap *pixmap;
421 GtkStyle *style;
422 PangoContext *context;
423 PangoLayout *layout;
424 gchar *markup;
425 gint width, height;
426 gint lwidth = 0, lheight = 0;
428 style = gtk_widget_get_style(widget);
430 gdk_pixbuf_render_pixmap_and_mask(*original, &pixmap, NULL, 255);
431 width = gdk_pixbuf_get_width(*original);
432 height = gdk_pixbuf_get_height(*original);
433 g_object_unref(G_OBJECT(*original));
435 context = gtk_widget_get_pango_context(widget);
436 layout = pango_layout_new(context);
438 markup = g_strdup_printf("<span foreground=\"#000000\">%s</span>", DISPLAY_VERSION);
439 pango_layout_set_font_description(layout, style->font_desc);
440 pango_layout_set_markup(layout, markup, strlen(markup));
441 g_free(markup);
443 pango_layout_get_pixel_size(layout, &lwidth, &lheight);
444 gdk_draw_layout(GDK_DRAWABLE(pixmap), style->bg_gc[GTK_STATE_NORMAL],
445 width - (lwidth + 3), 1, layout);
446 g_object_unref(G_OBJECT(layout));
448 *original = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL,
449 0, 0, 0, 0,
450 width, height);
451 g_object_unref(G_OBJECT(pixmap));
453 #endif
455 /* Note: Frees 'string' */
456 static GtkWidget *
457 pidgin_build_help_dialog(const char *title, const char *role, GString *string)
459 GtkWidget *win, *vbox, *frame, *logo, *imhtml, *button;
460 GdkPixbuf *pixbuf;
461 GtkTextIter iter;
462 AtkObject *obj;
463 char *filename, *tmp;
465 win = pidgin_create_dialog(title, PIDGIN_HIG_BORDER, role, TRUE);
466 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, PIDGIN_HIG_BORDER);
467 gtk_window_set_default_size(GTK_WINDOW(win), 450, 450);
469 /* Generate a logo with a version number */
470 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "logo.png", NULL);
471 pixbuf = pidgin_pixbuf_new_from_file(filename);
472 g_free(filename);
474 #if 0 /* Don't versionize the logo when the logo has the version in it */
475 pidgin_logo_versionize(&pixbuf, logo);
476 #endif
478 /* Insert the logo */
479 logo = gtk_image_new_from_pixbuf(pixbuf);
480 if (pixbuf)
481 g_object_unref(G_OBJECT(pixbuf));
482 obj = gtk_widget_get_accessible(logo);
483 tmp = g_strconcat(PIDGIN_NAME, " " DISPLAY_VERSION, NULL);
484 atk_object_set_description(obj, tmp);
485 g_free(tmp);
486 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0);
488 frame = pidgin_create_imhtml(FALSE, &imhtml, NULL, NULL);
489 gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY);
490 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
492 gtk_imhtml_append_text(GTK_IMHTML(imhtml), string->str, GTK_IMHTML_NO_SCROLL);
493 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter);
494 gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter);
496 button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE,
497 G_CALLBACK(destroy_win), win);
499 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
500 gtk_widget_grab_default(button);
502 gtk_widget_show_all(win);
503 gtk_window_present(GTK_WINDOW(win));
505 g_string_free(string, TRUE);
507 return win;
510 void pidgin_dialogs_about(void)
512 GString *str;
513 char *tmp;
514 static GtkWidget *about = NULL;
516 if (about != NULL) {
517 gtk_window_present(GTK_WINDOW(about));
518 return;
521 str = g_string_sized_new(4096);
523 g_string_append_printf(str,
524 "<CENTER><FONT SIZE=\"4\"><B>%s %s</B></FONT></CENTER> (libpurple %s)"
525 "<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION,
526 purple_core_get_version(), REVISION);
528 g_string_append_printf(str,
529 _("%s is a messaging client based on libpurple which is capable of "
530 "connecting to multiple messaging services at once. %s is written "
531 "in C using GTK+. %s is released, and may be modified and "
532 "redistributed, under the terms of the GPL version 2 (or later). "
533 "A copy of the GPL is distributed with %s. %s is copyrighted by "
534 "its contributors, a list of whom is also distributed with %s. "
535 "There is no warranty for %s.<BR><BR>"), PIDGIN_NAME, PIDGIN_NAME,
536 PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME);
538 g_string_append_printf(str,
539 _("<FONT SIZE=\"4\"><B>Helpful Resources</B></FONT><BR>\t<A "
540 "HREF=\"%s\">Website</A><BR>\t<A HREF=\"%s\">Frequently Asked "
541 "Questions</A><BR>\tIRC Channel: #pidgin on irc.freenode.net<BR>"
542 "\tXMPP MUC: devel@conference.pidgin.im<BR><BR>"), PURPLE_WEBSITE,
543 "http://developer.pidgin.im/wiki/FAQ");
545 g_string_append(str,
546 "<font size=\"4\"><b>Help for Oracle Employees</b></font> is "
547 "available from your normal internal helpdesk or IT department. "
548 "The Pidgin developer and user communities cannot assist you in "
549 "the configuration or use of Pidgin within Oracle, as we know "
550 "nothing of Oracle's infrastructure.<br/><br/>");
552 g_string_append(str,
553 _("<font size=\"4\"><b>Help from other Pidgin users</b></font> is "
554 "available by emailing <a "
555 "href=\"mailto:support@pidgin.im\">support@pidgin.im</a><br/>"
556 "This is a <b>public</b> mailing list! "
557 "(<a href=\"http://pidgin.im/pipermail/support/\">archive</a>)<br/>"
558 "We can't help with third-party protocols or plugins!<br/>"
559 "This list's primary language is <b>English</b>. You are "
560 "welcome to post in another language, but the responses may "
561 "be less helpful.<br/>"));
563 tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME);
564 about = pidgin_build_help_dialog(tmp, "about", str);
565 g_signal_connect(G_OBJECT(about), "destroy", G_CALLBACK(gtk_widget_destroyed), &about);
566 g_free(tmp);
569 void pidgin_dialogs_buildinfo(void)
571 GString *str;
572 char *tmp;
573 static GtkWidget *buildinfo = NULL;
575 if (buildinfo != NULL) {
576 gtk_window_present(GTK_WINDOW(buildinfo));
577 return;
580 str = g_string_sized_new(4096);
582 g_string_append_printf(str,
583 "<FONT SIZE=\"4\"><B>%s %s</B></FONT> (libpurple %s)<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION);
585 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s</B></FONT><br/>", _("Build Information"));
587 /* The following primarly intented for user/developer interaction and thus
588 ought not be translated */
590 #ifdef CONFIG_ARGS /* win32 build doesn't use configure */
591 g_string_append(str, " <b>Arguments to <i>./configure</i>:</b> " CONFIG_ARGS "<br/>");
592 #endif
594 #ifndef _WIN32
595 #ifdef DEBUG
596 g_string_append(str, " <b>Print debugging messages:</b> Yes<br/>");
597 #else
598 g_string_append(str, " <b>Print debugging messages:</b> No<br/>");
599 #endif
600 #endif
602 #ifdef PURPLE_PLUGINS
603 g_string_append(str, " <b>Plugins:</b> Enabled<br/>");
604 #else
605 g_string_append(str, " <b>Plugins:</b> Disabled<br/>");
606 #endif
608 #ifdef HAVE_SSL
609 g_string_append(str, " <b>SSL:</b> SSL support is present.<br/>");
610 #else
611 g_string_append(str, " <b>SSL:</b> SSL support was <b><i>NOT</i></b> compiled!<br/>");
612 #endif
614 /* This might be useful elsewhere too, but it is particularly useful for
615 * debugging stuff known to be GTK+/Glib bugs on Windows */
616 #ifdef _WIN32
617 g_string_append_printf(str, " <b>GTK+ Runtime:</b> %u.%u.%u<br/>"
618 " <b>Glib Runtime:</b> %u.%u.%u<br/>",
619 gtk_major_version, gtk_minor_version, gtk_micro_version,
620 glib_major_version, glib_minor_version, glib_micro_version);
621 #endif
623 g_string_append(str, "<br/> <b>Library Support</b><br/>");
625 #ifdef HAVE_CYRUS_SASL
626 g_string_append_printf(str, " <b>Cyrus SASL:</b> Enabled<br/>");
627 #else
628 g_string_append_printf(str, " <b>Cyrus SASL:</b> Disabled<br/>");
629 #endif
631 #ifndef _WIN32
632 #ifdef HAVE_DBUS
633 g_string_append_printf(str, " <b>D-Bus:</b> Enabled<br/>");
634 #else
635 g_string_append_printf(str, " <b>D-Bus:</b> Disabled<br/>");
636 #endif
638 #ifdef HAVE_EVOLUTION_ADDRESSBOOK
639 g_string_append_printf(str, " <b>Evolution Addressbook:</b> Enabled<br/>");
640 #else
641 g_string_append_printf(str, " <b>Evolution Addressbook:</b> Disabled<br/>");
642 #endif
643 #endif
645 #ifdef HAVE_LIBGADU
646 g_string_append(str, " <b>Gadu-Gadu library (libgadu):</b> External<br/>");
647 #else
648 g_string_append(str, " <b>Gadu-Gadu library (libgadu):</b> Internal<br/>");
649 #endif
651 #ifdef USE_GTKSPELL
652 g_string_append(str, " <b>GtkSpell:</b> Enabled<br/>");
653 #else
654 g_string_append(str, " <b>GtkSpell:</b> Disabled<br/>");
655 #endif
657 #ifdef HAVE_GNUTLS
658 g_string_append(str, " <b>GnuTLS:</b> Enabled<br/>");
659 #else
660 g_string_append(str, " <b>GnuTLS:</b> Disabled<br/>");
661 #endif
663 #ifndef _WIN32
664 #ifdef USE_GSTREAMER
665 g_string_append(str, " <b>GStreamer:</b> Enabled<br/>");
666 #else
667 g_string_append(str, " <b>GStreamer:</b> Disabled<br/>");
668 #endif
669 #endif
671 #ifndef _WIN32
672 #ifdef ENABLE_MONO
673 g_string_append(str, " <b>Mono:</b> Enabled<br/>");
674 #else
675 g_string_append(str, " <b>Mono:</b> Disabled<br/>");
676 #endif
677 #endif
679 #ifndef _WIN32
680 #ifdef HAVE_NETWORKMANAGER
681 g_string_append(str, " <b>NetworkManager:</b> Enabled<br/>");
682 #else
683 g_string_append(str, " <b>NetworkManager:</b> Disabled<br/>");
684 #endif
685 #endif
687 #ifdef HAVE_NSS
688 g_string_append(str, " <b>Network Security Services (NSS):</b> Enabled<br/>");
689 #else
690 g_string_append(str, " <b>Network Security Services (NSS):</b> Disabled<br/>");
691 #endif
693 if (purple_plugins_find_with_id("core-perl") != NULL)
694 g_string_append(str, " <b>Perl:</b> Enabled<br/>");
695 else
696 g_string_append(str, " <b>Perl:</b> Disabled<br/>");
698 if (purple_plugins_find_with_id("core-tcl") != NULL) {
699 g_string_append(str, " <b>Tcl:</b> Enabled<br/>");
700 #ifdef HAVE_TK
701 g_string_append(str, " <b>Tk:</b> Enabled<br/>");
702 #else
703 g_string_append(str, " <b>Tk:</b> Disabled<br/>");
704 #endif
705 } else {
706 g_string_append(str, " <b>Tcl:</b> Disabled<br/>");
707 g_string_append(str, " <b>Tk:</b> Disabled<br/>");
710 #ifdef USE_IDN
711 g_string_append(str, " <b>UTF-8 DNS (IDN):</b> Enabled<br/>");
712 #else
713 g_string_append(str, " <b>UTF-8 DNS (IDN):</b> Disabled<br/>");
714 #endif
716 #ifdef USE_VV
717 g_string_append(str, " <b>Voice and Video:</b> Enabled<br/>");
718 #else
719 g_string_append(str, " <b>Voice and Video:</b> Disabled<br/>");
720 #endif
722 #ifndef _WIN32
723 #ifdef USE_SM
724 g_string_append(str, " <b>X Session Management:</b> Enabled<br/>");
725 #else
726 g_string_append(str, " <b>X Session Management:</b> Disabled<br/>");
727 #endif
729 #ifdef USE_SCREENSAVER
730 g_string_append(str, " <b>XScreenSaver:</b> Enabled<br/>");
731 #else
732 g_string_append(str, " <b>XScreenSaver:</b> Disabled<br/>");
733 #endif
735 #ifdef LIBZEPHYR_EXT
736 g_string_append(str, " <b>Zephyr library (libzephyr):</b> External<br/>");
737 #else
738 g_string_append(str, " <b>Zephyr library (libzephyr):</b> Internal<br/>");
739 #endif
741 #ifdef ZEPHYR_USES_KERBEROS
742 g_string_append(str, " <b>Zephyr uses Kerberos:</b> Yes<br/>");
743 #else
744 g_string_append(str, " <b>Zephyr uses Kerberos:</b> No<br/>");
745 #endif
746 #endif
748 /* End of not to be translated section */
750 tmp = g_strdup_printf(_("%s Build Information"), PIDGIN_NAME);
751 buildinfo = pidgin_build_help_dialog(tmp, "buildinfo", str);
752 g_signal_connect(G_OBJECT(buildinfo), "destroy", G_CALLBACK(gtk_widget_destroyed), &buildinfo);
753 g_free(tmp);
756 void pidgin_dialogs_developers(void)
758 GString *str;
759 char *tmp;
760 static GtkWidget *developer_info = NULL;
762 if (developer_info != NULL) {
763 gtk_window_present(GTK_WINDOW(developer_info));
764 return;
767 str = g_string_sized_new(4096);
769 /* Current Developers */
770 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
771 _("Current Developers"));
772 add_developers(str, developers);
773 g_string_append(str, "<BR/>");
775 /* Crazy Patch Writers */
776 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
777 _("Crazy Patch Writers"));
778 add_developers(str, patch_writers);
779 g_string_append(str, "<BR/>");
781 /* Retired Developers */
782 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
783 _("Retired Developers"));
784 add_developers(str, retired_developers);
785 g_string_append(str, "<BR/>");
787 /* Retired Crazy Patch Writers */
788 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
789 _("Retired Crazy Patch Writers"));
790 add_developers(str, retired_patch_writers);
792 tmp = g_strdup_printf(_("%s Developer Information"), PIDGIN_NAME);
793 developer_info = pidgin_build_help_dialog(tmp, "developer_info", str);
794 g_signal_connect(G_OBJECT(developer_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &developer_info);
795 g_free(tmp);
798 void pidgin_dialogs_translators(void)
800 GString *str;
801 char *tmp;
802 static GtkWidget *translator_info = NULL;
804 if (translator_info != NULL) {
805 gtk_window_present(GTK_WINDOW(translator_info));
806 return;
809 str = g_string_sized_new(4096);
811 /* Current Translators */
812 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
813 _("Current Translators"));
814 add_translators(str, translators);
815 g_string_append(str, "<BR/>");
817 /* Past Translators */
818 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
819 _("Past Translators"));
820 add_translators(str, past_translators);
822 tmp = g_strdup_printf(_("%s Translator Information"), PIDGIN_NAME);
823 translator_info = pidgin_build_help_dialog(tmp, "translator_info", str);
824 g_signal_connect(G_OBJECT(translator_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &translator_info);
825 g_free(tmp);
828 void pidgin_dialogs_plugins_info(void)
830 GString *str;
831 GList *l = NULL;
832 PurplePlugin *plugin = NULL;
833 char *title = g_strdup_printf(_("%s Plugin Information"), PIDGIN_NAME);
834 char *pname = NULL, *pauthor = NULL;
835 const char *pver, *pwebsite, *pid;
836 gboolean ploaded, punloadable;
837 static GtkWidget *plugins_info = NULL;
839 str = g_string_sized_new(4096);
841 g_string_append_printf(str, "<FONT SIZE=\"4\">%s</FONT><BR/>",
842 _("Plugin Information"));
844 for(l = purple_plugins_get_all(); l; l = l->next) {
845 plugin = (PurplePlugin *)l->data;
847 pname = g_markup_escape_text(purple_plugin_get_name(plugin), -1);
848 pauthor = g_markup_escape_text(purple_plugin_get_author(plugin), -1);
849 pver = purple_plugin_get_version(plugin);
850 pwebsite = purple_plugin_get_homepage(plugin);
851 pid = purple_plugin_get_id(plugin);
852 punloadable = purple_plugin_is_unloadable(plugin);
853 ploaded = purple_plugin_is_loaded(plugin);
855 g_string_append_printf(str,
856 "<FONT SIZE=\"3\"><B>%s</B></FONT><BR/><FONT SIZE=\"2\">"
857 "\t<B>Author:</B> %s<BR/>\t<B>Version:</B> %s<BR/>"
858 "\t<B>Website:</B> %s<BR/>\t<B>ID String:</B> %s<BR/>"
859 "\t<B>Loadable:</B> %s<BR/>\t<B>Loaded:</B> %s<BR/>"
860 "<BR/></FONT>", pname, pauthor ? pauthor : "(null)",
861 pver, pwebsite, pid,
862 punloadable ? "<FONT COLOR=\"#FF0000\"><B>No</B></FONT>" : "Yes",
863 ploaded ? "Yes" : "No");
866 plugins_info = pidgin_build_help_dialog(title, "plugins_info", str);
867 g_signal_connect(G_OBJECT(plugins_info), "destroy",
868 G_CALLBACK(gtk_widget_destroyed), &plugins_info);
869 g_free(title);
870 g_free(pname);
871 g_free(pauthor);
874 static void
875 pidgin_dialogs_im_cb(gpointer data, PurpleRequestFields *fields)
877 PurpleAccount *account;
878 const char *username;
880 account = purple_request_fields_get_account(fields, "account");
881 username = purple_request_fields_get_string(fields, "screenname");
883 pidgin_dialogs_im_with_user(account, username);
886 void
887 pidgin_dialogs_im(void)
889 PurpleRequestFields *fields;
890 PurpleRequestFieldGroup *group;
891 PurpleRequestField *field;
893 fields = purple_request_fields_new();
895 group = purple_request_field_group_new(NULL);
896 purple_request_fields_add_group(fields, group);
898 field = purple_request_field_string_new("screenname", _("_Name"), NULL, FALSE);
899 purple_request_field_set_type_hint(field, "screenname");
900 purple_request_field_set_required(field, TRUE);
901 purple_request_field_group_add_field(group, field);
903 field = purple_request_field_account_new("account", _("_Account"), NULL);
904 purple_request_field_set_type_hint(field, "account");
905 purple_request_field_set_visible(field,
906 (purple_connections_get_all() != NULL &&
907 purple_connections_get_all()->next != NULL));
908 purple_request_field_set_required(field, TRUE);
909 purple_request_field_group_add_field(group, field);
911 purple_request_fields(purple_get_blist(), _("New Instant Message"),
912 NULL,
913 _("Please enter the username or alias of the person "
914 "you would like to IM."),
915 fields,
916 _("OK"), G_CALLBACK(pidgin_dialogs_im_cb),
917 _("Cancel"), NULL,
918 NULL, NULL, NULL,
919 NULL);
922 void
923 pidgin_dialogs_im_with_user(PurpleAccount *account, const char *username)
925 PurpleConversation *conv;
927 g_return_if_fail(account != NULL);
928 g_return_if_fail(username != NULL);
930 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, username, account);
932 if (conv == NULL)
933 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username);
935 pidgin_conv_attach_to_conversation(conv);
936 purple_conversation_present(conv);
939 static gboolean
940 pidgin_dialogs_ee(const char *ee)
942 GtkWidget *window;
943 GtkWidget *hbox;
944 GtkWidget *label;
945 GtkWidget *img;
946 gchar *norm = purple_strreplace(ee, "rocksmyworld", "");
948 label = gtk_label_new(NULL);
949 if (purple_strequal(norm, "zilding"))
950 gtk_label_set_markup(GTK_LABEL(label),
951 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>");
952 else if (purple_strequal(norm, "robflynn"))
953 gtk_label_set_markup(GTK_LABEL(label),
954 "<span weight=\"bold\" size=\"large\" foreground=\"#1f6bad\">Pimpin\' Penguin Style! *Waddle Waddle*</span>");
955 else if (purple_strequal(norm, "flynorange"))
956 gtk_label_set_markup(GTK_LABEL(label),
957 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>");
958 else if (purple_strequal(norm, "ewarmenhoven"))
959 gtk_label_set_markup(GTK_LABEL(label),
960 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>");
961 else if (purple_strequal(norm, "markster97"))
962 gtk_label_set_markup(GTK_LABEL(label),
963 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>");
964 else if (purple_strequal(norm, "seanegn"))
965 gtk_label_set_markup(GTK_LABEL(label),
966 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>");
967 else if (purple_strequal(norm, "chipx86"))
968 gtk_label_set_markup(GTK_LABEL(label),
969 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>");
970 else if (purple_strequal(norm, "markdoliner"))
971 gtk_label_set_markup(GTK_LABEL(label),
972 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>");
973 else if (purple_strequal(norm, "lschiere"))
974 gtk_label_set_markup(GTK_LABEL(label),
975 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>");
976 g_free(norm);
978 if (strlen(gtk_label_get_label(GTK_LABEL(label))) <= 0)
979 return FALSE;
981 window = gtk_dialog_new_with_buttons(PIDGIN_ALERT_TITLE, NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL);
982 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK);
983 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL);
985 gtk_container_set_border_width (GTK_CONTAINER(window), PIDGIN_HIG_BOX_SPACE);
986 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
987 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE);
988 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BORDER);
989 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BOX_SPACE);
991 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
992 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox);
993 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_COOL, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
994 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
996 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
997 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
998 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1000 gtk_widget_show_all(window);
1001 return TRUE;
1004 static void
1005 pidgin_dialogs_info_cb(gpointer data, PurpleRequestFields *fields)
1007 char *username;
1008 gboolean found = FALSE;
1009 PurpleAccount *account;
1011 account = purple_request_fields_get_account(fields, "account");
1013 username = g_strdup(purple_normalize(account,
1014 purple_request_fields_get_string(fields, "screenname")));
1016 if (username != NULL && purple_str_has_suffix(username, "rocksmyworld"))
1017 found = pidgin_dialogs_ee(username);
1019 if (!found && username != NULL && *username != '\0' && account != NULL)
1020 pidgin_retrieve_user_info(purple_account_get_connection(account), username);
1022 g_free(username);
1025 void
1026 pidgin_dialogs_info(void)
1028 PurpleRequestFields *fields;
1029 PurpleRequestFieldGroup *group;
1030 PurpleRequestField *field;
1032 fields = purple_request_fields_new();
1034 group = purple_request_field_group_new(NULL);
1035 purple_request_fields_add_group(fields, group);
1037 field = purple_request_field_string_new("screenname", _("_Name"), NULL, FALSE);
1038 purple_request_field_set_type_hint(field, "screenname");
1039 purple_request_field_set_required(field, TRUE);
1040 purple_request_field_group_add_field(group, field);
1042 field = purple_request_field_account_new("account", _("_Account"), NULL);
1043 purple_request_field_set_type_hint(field, "account");
1044 purple_request_field_set_visible(field,
1045 (purple_connections_get_all() != NULL &&
1046 purple_connections_get_all()->next != NULL));
1047 purple_request_field_set_required(field, TRUE);
1048 purple_request_field_group_add_field(group, field);
1050 purple_request_fields(purple_get_blist(), _("Get User Info"),
1051 NULL,
1052 _("Please enter the username or alias of the person "
1053 "whose info you would like to view."),
1054 fields,
1055 _("OK"), G_CALLBACK(pidgin_dialogs_info_cb),
1056 _("Cancel"), NULL,
1057 NULL, NULL, NULL,
1058 NULL);
1061 static void
1062 pidgin_dialogs_log_cb(gpointer data, PurpleRequestFields *fields)
1064 char *username;
1065 PurpleAccount *account;
1066 GSList *cur;
1068 account = purple_request_fields_get_account(fields, "account");
1070 username = g_strdup(purple_normalize(account,
1071 purple_request_fields_get_string(fields, "screenname")));
1073 if (username != NULL && *username != '\0' && account != NULL)
1075 PidginBuddyList *gtkblist = pidgin_blist_get_default_gtk_blist();
1076 GSList *buddies;
1078 pidgin_set_cursor(gtkblist->window, GDK_WATCH);
1080 buddies = purple_find_buddies(account, username);
1081 for (cur = buddies; cur != NULL; cur = cur->next)
1083 PurpleBlistNode *node = cur->data;
1084 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL)))
1086 pidgin_log_show_contact((PurpleContact *)node->parent);
1087 g_slist_free(buddies);
1088 pidgin_clear_cursor(gtkblist->window);
1089 g_free(username);
1090 return;
1093 g_slist_free(buddies);
1095 pidgin_log_show(PURPLE_LOG_IM, username, account);
1097 pidgin_clear_cursor(gtkblist->window);
1100 g_free(username);
1104 * TODO - This needs to deal with logs of all types, not just IM logs.
1106 void
1107 pidgin_dialogs_log(void)
1109 PurpleRequestFields *fields;
1110 PurpleRequestFieldGroup *group;
1111 PurpleRequestField *field;
1113 fields = purple_request_fields_new();
1115 group = purple_request_field_group_new(NULL);
1116 purple_request_fields_add_group(fields, group);
1118 field = purple_request_field_string_new("screenname", _("_Name"), NULL, FALSE);
1119 purple_request_field_set_type_hint(field, "screenname-all");
1120 purple_request_field_set_required(field, TRUE);
1121 purple_request_field_group_add_field(group, field);
1123 field = purple_request_field_account_new("account", _("_Account"), NULL);
1125 /* purple_request_field_account_new() only sets a default value if you're
1126 * connected, and it sets it from the list of connected accounts. Since
1127 * we're going to set show_all here, it makes sense to use the first
1128 * account, not the first connected account. */
1129 if (purple_accounts_get_all() != NULL) {
1130 purple_request_field_account_set_default_value(field, purple_accounts_get_all()->data);
1131 purple_request_field_account_set_value(field, purple_accounts_get_all()->data);
1134 purple_request_field_set_type_hint(field, "account");
1135 purple_request_field_account_set_show_all(field, TRUE);
1136 purple_request_field_set_visible(field,
1137 (purple_accounts_get_all() != NULL &&
1138 purple_accounts_get_all()->next != NULL));
1139 purple_request_field_set_required(field, TRUE);
1140 purple_request_field_group_add_field(group, field);
1142 purple_request_fields(purple_get_blist(), _("View User Log"),
1143 NULL,
1144 _("Please enter the username or alias of the person "
1145 "whose log you would like to view."),
1146 fields,
1147 _("OK"), G_CALLBACK(pidgin_dialogs_log_cb),
1148 _("Cancel"), NULL,
1149 NULL, NULL, NULL,
1150 NULL);
1153 static void
1154 pidgin_dialogs_alias_contact_cb(PurpleContact *contact, const char *new_alias)
1156 purple_blist_alias_contact(contact, new_alias);
1159 void
1160 pidgin_dialogs_alias_contact(PurpleContact *contact)
1162 g_return_if_fail(contact != NULL);
1164 purple_request_input(NULL, _("Alias Contact"), NULL,
1165 _("Enter an alias for this contact."),
1166 contact->alias, FALSE, FALSE, NULL,
1167 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_contact_cb),
1168 _("Cancel"), NULL,
1169 NULL, purple_contact_get_alias(contact), NULL,
1170 contact);
1173 static void
1174 pidgin_dialogs_alias_buddy_cb(PurpleBuddy *buddy, const char *new_alias)
1176 purple_blist_alias_buddy(buddy, new_alias);
1177 serv_alias_buddy(buddy);
1180 void
1181 pidgin_dialogs_alias_buddy(PurpleBuddy *buddy)
1183 gchar *secondary;
1185 g_return_if_fail(buddy != NULL);
1187 secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name);
1189 purple_request_input(NULL, _("Alias Buddy"), NULL,
1190 secondary, buddy->alias, FALSE, FALSE, NULL,
1191 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_buddy_cb),
1192 _("Cancel"), NULL,
1193 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL,
1194 buddy);
1196 g_free(secondary);
1199 static void
1200 pidgin_dialogs_alias_chat_cb(PurpleChat *chat, const char *new_alias)
1202 purple_blist_alias_chat(chat, new_alias);
1205 void
1206 pidgin_dialogs_alias_chat(PurpleChat *chat)
1208 g_return_if_fail(chat != NULL);
1210 purple_request_input(NULL, _("Alias Chat"), NULL,
1211 _("Enter an alias for this chat."),
1212 chat->alias, FALSE, FALSE, NULL,
1213 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_chat_cb),
1214 _("Cancel"), NULL,
1215 chat->account, NULL, NULL,
1216 chat);
1219 static void
1220 pidgin_dialogs_remove_contact_cb(PurpleContact *contact)
1222 PurpleBlistNode *bnode, *cnode;
1223 PurpleGroup *group;
1225 cnode = (PurpleBlistNode *)contact;
1226 group = (PurpleGroup*)cnode->parent;
1227 for (bnode = cnode->child; bnode; bnode = bnode->next) {
1228 PurpleBuddy *buddy = (PurpleBuddy*)bnode;
1229 if (purple_account_is_connected(buddy->account))
1230 purple_account_remove_buddy(buddy->account, buddy, group);
1232 purple_blist_remove_contact(contact);
1235 void
1236 pidgin_dialogs_remove_contact(PurpleContact *contact)
1238 PurpleBuddy *buddy = purple_contact_get_priority_buddy(contact);
1240 g_return_if_fail(contact != NULL);
1241 g_return_if_fail(buddy != NULL);
1243 if (PURPLE_BLIST_NODE(contact)->child == PURPLE_BLIST_NODE(buddy) &&
1244 PURPLE_BLIST_NODE(buddy)->next == NULL) {
1245 pidgin_dialogs_remove_buddy(buddy);
1246 } else {
1247 gchar *text;
1248 text = g_strdup_printf(
1249 ngettext(
1250 "You are about to remove the contact containing %s "
1251 "and %d other buddy from your buddy list. Do you "
1252 "want to continue?",
1253 "You are about to remove the contact containing %s "
1254 "and %d other buddies from your buddy list. Do you "
1255 "want to continue?", contact->totalsize - 1),
1256 buddy->name, contact->totalsize - 1);
1258 purple_request_action(contact, NULL, _("Remove Contact"), text, 0,
1259 NULL, purple_contact_get_alias(contact), NULL,
1260 contact, 2,
1261 _("_Remove Contact"), G_CALLBACK(pidgin_dialogs_remove_contact_cb),
1262 _("Cancel"),
1263 NULL);
1265 g_free(text);
1269 static void free_ggmo(struct _PidginGroupMergeObject *ggp)
1271 g_free(ggp->new_name);
1272 g_free(ggp);
1275 static void
1276 pidgin_dialogs_merge_groups_cb(struct _PidginGroupMergeObject *GGP)
1278 purple_blist_rename_group(GGP->parent, GGP->new_name);
1279 free_ggmo(GGP);
1282 void
1283 pidgin_dialogs_merge_groups(PurpleGroup *source, const char *new_name)
1285 gchar *text;
1286 struct _PidginGroupMergeObject *ggp;
1288 g_return_if_fail(source != NULL);
1289 g_return_if_fail(new_name != NULL);
1291 text = g_strdup_printf(
1292 _("You are about to merge the group called %s into the group "
1293 "called %s. Do you want to continue?"), source->name, new_name);
1295 ggp = g_new(struct _PidginGroupMergeObject, 1);
1296 ggp->parent = source;
1297 ggp->new_name = g_strdup(new_name);
1299 purple_request_action(source, NULL, _("Merge Groups"), text, 0,
1300 NULL, NULL, NULL,
1301 ggp, 2,
1302 _("_Merge Groups"), G_CALLBACK(pidgin_dialogs_merge_groups_cb),
1303 _("Cancel"), G_CALLBACK(free_ggmo));
1305 g_free(text);
1308 static void
1309 pidgin_dialogs_remove_group_cb(PurpleGroup *group)
1311 PurpleBlistNode *cnode, *bnode;
1313 cnode = ((PurpleBlistNode*)group)->child;
1315 while (cnode) {
1316 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
1317 bnode = cnode->child;
1318 cnode = cnode->next;
1319 while (bnode) {
1320 PurpleBuddy *buddy;
1321 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) {
1322 buddy = (PurpleBuddy*)bnode;
1323 bnode = bnode->next;
1324 if (purple_account_is_connected(buddy->account)) {
1325 purple_account_remove_buddy(buddy->account, buddy, group);
1326 purple_blist_remove_buddy(buddy);
1328 } else {
1329 bnode = bnode->next;
1332 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) {
1333 PurpleChat *chat = (PurpleChat *)cnode;
1334 cnode = cnode->next;
1335 if (purple_account_is_connected(chat->account))
1336 purple_blist_remove_chat(chat);
1337 } else {
1338 cnode = cnode->next;
1342 purple_blist_remove_group(group);
1345 void
1346 pidgin_dialogs_remove_group(PurpleGroup *group)
1348 gchar *text;
1350 g_return_if_fail(group != NULL);
1352 text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"),
1353 group->name);
1355 purple_request_action(group, NULL, _("Remove Group"), text, 0,
1356 NULL, NULL, NULL,
1357 group, 2,
1358 _("_Remove Group"), G_CALLBACK(pidgin_dialogs_remove_group_cb),
1359 _("Cancel"), NULL);
1361 g_free(text);
1364 /* XXX - Some of this should be moved into the core, methinks. */
1365 static void
1366 pidgin_dialogs_remove_buddy_cb(PurpleBuddy *buddy)
1368 PurpleGroup *group;
1369 gchar *name;
1370 PurpleAccount *account;
1372 group = purple_buddy_get_group(buddy);
1373 name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */
1374 account = buddy->account;
1376 purple_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name);
1377 /* TODO - Should remove from blist first... then call purple_account_remove_buddy()? */
1378 purple_account_remove_buddy(account, buddy, group);
1379 purple_blist_remove_buddy(buddy);
1381 g_free(name);
1384 void
1385 pidgin_dialogs_remove_buddy(PurpleBuddy *buddy)
1387 gchar *text;
1389 g_return_if_fail(buddy != NULL);
1391 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"),
1392 buddy->name);
1394 purple_request_action(buddy, NULL, _("Remove Buddy"), text, 0,
1395 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL,
1396 buddy, 2,
1397 _("_Remove Buddy"), G_CALLBACK(pidgin_dialogs_remove_buddy_cb),
1398 _("Cancel"), NULL);
1400 g_free(text);
1403 static void
1404 pidgin_dialogs_remove_chat_cb(PurpleChat *chat)
1406 purple_blist_remove_chat(chat);
1409 void
1410 pidgin_dialogs_remove_chat(PurpleChat *chat)
1412 const gchar *name;
1413 gchar *text;
1415 g_return_if_fail(chat != NULL);
1417 name = purple_chat_get_name(chat);
1418 text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"),
1419 name ? name : "");
1421 purple_request_action(chat, NULL, _("Remove Chat"), text, 0,
1422 chat->account, NULL, NULL,
1423 chat, 2,
1424 _("_Remove Chat"), G_CALLBACK(pidgin_dialogs_remove_chat_cb),
1425 _("Cancel"), NULL);
1427 g_free(text);